-
Notifications
You must be signed in to change notification settings - Fork 23
Fluke/zotac zone dials #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WIP. Needs help |
49036c0
to
b9776ed
Compare
a7829a8
to
5b0af67
Compare
I'm at a loss as to why I'm getting a dual event:
Doesn't make sense at all. Kernel driver ouputs a single event. |
|
You have the x axis of the dial mapped to two events, so it will trigger on both. You should translate the InputValue for that capability to clockwise/counterclockwise based on the axis value being > 0 / < 0 instead. |
@pastaq can you walk me through this please? There is just too much repetitive code for me to follow around here. |
Hmm no I think I understand now. |
61ce07d
to
28163d3
Compare
Alright so everything works now except for this particular problem: The driver emits and re-emits either I'm not really all that sure how best to handle return match direction.as_str() {
"clockwise" => {
if let Some(x) = x {
if x > 0.0 {
Ok(InputValue::Bool(true))
} else {
Ok(InputValue::None)
}
} else {
Ok(InputValue::None)
}
}
"counter-clockwise" => {
if let Some(x) = x {
if x < 0.0 {
Ok(InputValue::Bool(true))
} else {
Ok(InputValue::None)
}
} else {
Ok(InputValue::None)
}
} I never get another event from IP on these. They are stuck on |
Looking at this more, since these events do not have a "button up" state, you'll need to emulate that yourself when encountering a dial -> button translation. It seems like what you want to do is send a "button down" + "button up" event for each "tick" of the dial. So we'll need to translate that single dial event into "button down" + "button up" events. There may be a more elegant way to do this, but what first comes to mind is you could handle this in the E.g. // Translate the event into the defined target event(s)
for target_event in mapping.target_events.iter() {
// TODO: We can cache this conversion for faster translation
let target_cap: Capability = target_event.clone().into();
let result = event.get_value().translate(
&source_cap,
&mapping.source_event,
&target_cap,
target_event,
);
let value = match result {
Ok(v) => v,
...
};
if matches!(value, InputValue::None) {
continue;
}
// If the the event translation should result in a button pulse, return the
// translated pulse events.
if source_cap.is_button_pulse_translation(target_cap) {
let event = NativeEvent::new_translated(source_cap.clone(), target_cap, InputValue::Bool(true));
events.push(event);
let event = NativeEvent::new_translated(source_cap.clone(), target_cap, InputValue::Bool(false));
events.push(event);
continue;
}
let event = NativeEvent::new_translated(source_cap.clone(), target_cap, value);
events.push(event);
}
... |
650e614
to
3300b3d
Compare
Alright, this is working now. So cleanup is required. |
Full support for the driver to enable the majority of use-cases. Does not include proper support of dial/wheels or touchpads. Signed-off-by: Luke Jones <[email protected]>
a295973
to
e1b0222
Compare
Signed-off-by: Luke Jones <[email protected]>
e1b0222
to
7810744
Compare
No description provided.