No description
Find a file
Nicolas Koch 16810308e4 Add Device::send_event and RawDevice::send_event.
Some devices (such as keyboards) support writing events through event nodes to
turn LEDs off and on, play sound effects or play ff effects.
This commits adds the appropriate methods in the public API of the crate.

I also added an example to showcase the new functionality.
2021-12-05 19:25:15 +01:00
examples Add Device::send_event and RawDevice::send_event. 2021-12-05 19:25:15 +01:00
src Add Device::send_event and RawDevice::send_event. 2021-12-05 19:25:15 +01:00
.gitignore Update dependencies and fix cross-compatibility issues (#24) 2021-02-20 19:09:39 -07:00
.travis.yml Add GH_TOKEN 2015-07-21 08:07:36 -04:00
Cargo.toml Release 0.11.2 2021-12-03 21:52:09 -06:00
README.md Separate out sane blocking and async (nonblocking) implementations (#33) 2021-03-01 10:09:11 -07:00

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.