-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fluke/zotac zone dials #339
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. |
e1b0222
to
7810744
Compare
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]>
7d60e03
to
6d9d451
Compare
Cleaned up extraneous formatting. Tested. Should be good to go pending review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comment cleanup, otherwise LGTM, thanks!
6d9d451
to
b9981ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also some small suggestions in addition to @pastaq 's. Otherwise looks good!
b9981ba
to
7cf5b5d
Compare
Add ability to output the screen-brightness keycode events which can enable screen brightness controls if the environment uses them. Also map the Zotac Zone dials to emit volume control + screen brightness. Signed-off-by: Luke Jones <[email protected]>
7cf5b5d
to
354229e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks!
🎉 This PR is included in version 0.55.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
No description provided.