8 releases

0.11.0 May 21, 2021
0.10.2 Dec 26, 2020
0.10.1 Jun 17, 2017
0.9.3 Apr 27, 2017
0.1.0 May 31, 2015
Download history 241/week @ 2021-02-26 179/week @ 2021-03-05 120/week @ 2021-03-12 267/week @ 2021-03-19 228/week @ 2021-03-26 160/week @ 2021-04-02 136/week @ 2021-04-09 111/week @ 2021-04-16 114/week @ 2021-04-23 126/week @ 2021-04-30 107/week @ 2021-05-07 98/week @ 2021-05-14 180/week @ 2021-05-21 127/week @ 2021-05-28 139/week @ 2021-06-04 188/week @ 2021-06-11

702 downloads per month
Used in less than 8 crates

Apache-2.0 OR MIT

115KB
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
~41K SLoC