-
Notifications
You must be signed in to change notification settings - Fork 75
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
implement get_sys_path() and dev node iterator for virtual devices #72
Conversation
This commit switches the underlying evdev library from evdev-rs to evdev again. Using the evdev-rs library for uinput devices caused a regression in mouse button functionality. Git bisect shows that the mouse functionality broke in commit 6b4a7e5. In addition, it looks like a PR is currently open for getting the dev node info in the evdev crate, so hopefully there will be feature parity to support the symlink code soon: emberian/evdev#72
@jeff-hiner This is ready for review. |
This commit switches the underlying evdev library from evdev-rs to evdev again. Using the evdev-rs library for uinput devices caused a regression in mouse button functionality. Git bisect shows that the mouse functionality broke in commit 6b4a7e5. In addition, it looks like a PR is currently open for getting the dev node info in the evdev crate, so hopefully there will be feature parity to support the symlink code soon: emberian/evdev#72
src/uinput.rs
Outdated
|
||
/// This struct is returned from the [VirtualDevice::enumerate_dev_nodes] function and will yield | ||
/// the syspaths corresponding to the virtual device. These are of the form `/dev/input123`. | ||
#[cfg(not(feature = "tokio"))] |
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.
Bit of a further nit, but can we either ungate this or gate this behind a blocking
feature? In a single binary if one crate user were to define tokio
and another does not it'll really confuse cargo. I'd like to make sure that if someone really wants to they could build and use both simultaneously.
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.
Oh right, it makes sense to not even have the feature gate there if we are differentiating them anyway.
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.
You will need to somehow disambiguate the two DevNodes
structs as well.
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.
That's right. I had a much better look now and fixed a few other things too:
- Added
fs
feature flag to the tokio dependency, socargo b --features tokio
actually works. - Because of the
.await?
, the async version of the iterator is dealing with justOption<T>
which simplifies the code. - Renamed the
DevNodes
variant for the sync version toDevNodesBlocking
so they can co-exist.
With the tokio feature flag, one should have access to both the sync and async versions.
This addresses issue #70 by:
VirtualDevice::get_syspath()
function, which returns the syspath of the form/sys/devices/virtual/input/inputX
for the virtual device.VirtualDevice::enumerate_dev_nodes()
depending on thetokio
feature flag that essentially yields an iterator over the devices nodes of the form/dev/input/eventX
that correspond to the virtual device.