12 releases

new 0.11.4 Jan 12, 2022
0.11.3 Dec 7, 2021
0.11.1 Oct 8, 2021
0.11.0 May 21, 2021
0.9.2 Jul 21, 2015
Download history 85/week @ 2021-09-29 160/week @ 2021-10-06 189/week @ 2021-10-13 371/week @ 2021-10-20 220/week @ 2021-10-27 488/week @ 2021-11-03 1128/week @ 2021-11-10 541/week @ 2021-11-17 425/week @ 2021-11-24 300/week @ 2021-12-01 549/week @ 2021-12-08 379/week @ 2021-12-15 892/week @ 2021-12-22 656/week @ 2021-12-29 900/week @ 2022-01-05 1085/week @ 2022-01-12

3,656 downloads per month
Used in 13 crates (12 directly)

Apache-2.0 OR MIT

120KB
2.5K SLoC

evdev

Travis Crates.io

Documentation

Nice(r) access to evdev devices.

What is evdev?

evdev is the Linux kernel's generic input interface, also implemented by other kernels such as FreeBSD.

This crate exposes access to these sorts of input devices. There is some trickery involved, so please read the crate documentation.

What does this library support?

This library exposes raw evdev events, but uses the Rust Iterator trait to do so. When processing events via fetch_events, the library will handle SYN_DROPPED events by injecting fake state updates in an attempt to ensure callers see state transition messages consistent with actual device state. When processing via *_no_sync this correction is not done, and SYN_DROPPED messages will appear if the kernel ring buffer is overrun before messages are read. I try to match libevdev closely, where possible.

Writing to devices is not yet supported (eg, turning LEDs on).

There is no abstraction for gamepad-like devices that allows mapping button numbers to logical buttons, nor is one planned. Such a thing should take place in a higher-level crate, likely supporting multiple platforms.

Example

See <examples/evtest.rs> for an example of using this library (which roughly corresponds to the userspace evtest tool.

Dependencies

~2MB
~45K SLoC