Crates.io | sweetacid-evdev |
lib.rs | sweetacid-evdev |
version | 0.11.6 |
source | src |
created_at | 2021-10-23 09:19:51.3758 |
updated_at | 2021-10-23 11:40:01.42148 |
description | evdev interface for Linux |
homepage | |
repository | https://github.com/cmr/evdev |
max_upload_size | |
id | 469805 |
size | 135,538 |
evdev
Nice(r) access to evdev
devices.
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.
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.
See <examples/evtest.rs> for an example of using this library (which roughly corresponds to the userspace evtest tool.