Skip to content
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

Use evdev to create and write device #57

Merged
merged 1 commit into from
Jul 23, 2022
Merged

Use evdev to create and write device #57

merged 1 commit into from
Jul 23, 2022

Conversation

jtroo
Copy link
Owner

@jtroo jtroo commented Jul 22, 2022

The evdev crate is added and these dependencies are dropped:

  • libc
  • uinput-sys
  • evdev-rs

Replace uinput-sys with evdev because evdev is a wrapper library for
evdev devices that provides interfaces to create uinput devices and send
events. Using evdev is less error-prone than accessing uinput directly,
and should be considered for new software1. evdev is also needed to
create a symlink in /dev/input/by-id/

libc is dropped since its struct definitions are no longer required.

evdev-rs is replaced by evdev so that the system library libevdev is no
longer a dependency.

@jtroo
Copy link
Owner Author

jtroo commented Jul 22, 2022

Pinging @jian-lin, let me know what you think

Copy link
Contributor

@jian-lin jian-lin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM. Tested and works well.

.into_iter()
.for_each(|ev| self.events.push_back(ev));
}
Ok(self.events.pop_front().expect("not empty"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ok(self.events.pop_front().expect("not empty"))
Ok(self.events.pop_front().expect("event queue is empty"))

Usually, this message tells us why it fails.

The evdev crate is added and these dependencies are dropped:
- libc
- uinput-sys
- evdev-rs

Replace uinput-sys with evdev because evdev is a wrapper library for
evdev devices that provides interfaces to create uinput devices and send
events. Using evdev is less error-prone than accessing uinput directly,
and should be considered for new software[1]. evdev is also needed to
create a symlink in /dev/input/by-id/

libc is dropped since its struct definitions are no longer required.

evdev-rs is replaced by evdev so that the system library libevdev is no
longer a dependency.

[1]: https://www.kernel.org/doc/html/latest/input/uinput.html
@jtroo jtroo merged commit 168137c into main Jul 23, 2022
@jtroo jtroo deleted the use-evdev branch July 23, 2022 07:39
@jian-lin
Copy link
Contributor

Sorry, I just find that evdev crate cannot get the devnode of VirtualDevice.

I have filled a feature request emberian/evdev#70.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants