Expand description
§evdevil: Rust bindings to evdev and uinput
This library provides an interface to the Linux and FreeBSD input device subsystem.
§Features
- Ergonomic Rusty API designed for stability.
- Exposes almost every
evdevanduinputfeature, including force-feedback and multitouch. - Device Hotplug support.
- Light on dependencies.
- FreeBSD compatibility.
asyncsupport via Tokio orasync-io.
§Cargo Features
| Feature | Description |
|---|---|
serde | Implements Serialize and Deserialize for many event code wrappers like Key, Rel, etc. |
tokio | Uses Tokio to enable async event reading. |
async-io | Uses async-io to enable async event reading. |
The tokio and async-io features are mutually exclusive.
Compilation will fail if both are enabled.
§Rust Version Support
This library targets the latest stable Rust version.
Older Rust versions are supported by equally older versions of this crate. For example, to use a version of Rust that was succeeded 6 months ago, you’d also use an at least 6 month old version of this library.
Compatibility with older Rust versions may be provided on a best-effort basis.
The minimum supported Rust version is specified as rust-version in Cargo.toml, and tested
against in CI, so Cargo’s resolver should find a version for you that works.
§Development
Documentation for Linux’ input subsystem can be found at https://www.kernel.org/doc/html/latest/input/index.html.
§Testing
The crate is tested using end-to-end tests that create a virtual uinput device and then open it.
This means the user running the tests needs to have permission to write to /dev/uinput and the input devices in /dev/input/event*.
To run the test suite (and all examples) via sudo, you can place this .cargo/config.toml file in your repository checkout:
[target.'cfg(true)']
runner = "sudo -E --preserve-env=PATH"Modules§
- bits
- A
BitSetfor values reported byevdev. - enumerate
- Device enumeration.
- event
- Input event types and enumerations.
- ff
- Force-feedback support.
- hotplug
- Support for hotplug events.
- reader
- A convenient API for robustly reading device events.
- uinput
- Userspace input devices.
Structs§
- AbsInfo
- Information about an absolute axis (
Abs). - Bus
- Bus types that devices can be attached to the system with.
- Evdev
- A handle to an event device.
- Event
Reader - Stores a userspace view of a device, and reads events emitted by it.
- InputId
- Input device ID.
- Input
Prop - Input device properties.
- KeyRepeat
- Key repeat settings.
- Keymap
Entry - A device keymap entry translates a scancode to a keycode.
- RawEvents
- Reads raw
InputEvents from anEvdev. - Scancode
- A raw scancode emitted by a keyboard.
- Slot
- A multitouch slot index.
- Unknown
Variant - Error returned by
FromStrimplementations when no matching variant was found. - Version
- An
evdevsubsystem version.
Functions§
- enumerate
- Enumerates all currently plugged-in
Evdevdevices. - enumerate_
hotplug - Enumerates all currently plugged-in
Evdevdevices, and future hotplugged devices.