GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.rs — evdev - Rust Available on Unix only. Expand descriptionLinux event device handling. The Linux kernel’s “evdev” subsystem exposes input devices to userspace in a generic, consistent way. I’ll try to explain the device model as completely as possible. The upstream kernel documentation is split across two files:
The Applications can interact with §DevicesDevices can be opened directly via their path: This approach requires the calling process to have the appropriate privileges to open the device node (typically this requires running as root user). Alternatively a device can be created from an already open file descriptor. This approach is useful where the file descriptor is provided by an external privileged process (e.g. systemd’s logind): §Input EventsDevices emit events, represented by the The kernel documentation specifies different event types, reperesented by the For most event types the kernel documentation also specifies a set of codes, represented by a new-type
e.g. A All events (even single events) are sent in batches followed by a synchronization event:
The evdev crate exposes functions to query the current state of a device from the kernel, as well as a function that can be called continuously to provide an iterator over update events as they arrive. §Matching EventsWhen reading from an input Device it is often useful to check which type/code or value
the event has. This library provides the §Synchronizing versus Raw modesThis library can be used in either Raw or Synchronizing modes, which correspond roughly to
evdev’s In synchronous mode, this library tries to ease that pain by removing the corrupted events and injecting fake events as if the device had updated normally. Note that this is best-effort; events can never be recovered once lost. This synchronization comes at a performance cost: each set of input events read from the kernel in turn updates an internal state buffer, and events must be internally held back until the end of each frame. If this latency is unacceptable or for any reason you want to see every event directly, a raw stream reader is also provided. As an example of how synchronization behaves, if a switch is toggled twice there will be two switch events in the buffer. However, if the kernel needs to drop events, when the device goes to synchronize state with the kernel only one (or zero, if the switch is in the same state as it was before the sync) switch events will be visible in the stream. This cache can also be queried. For example, the It is recommended that you dedicate a thread to processing input events, or use epoll or an
async runtime with the fd returned by For demonstrations of how to use this library in blocking, nonblocking, and async (tokio) modes, please reference the “examples” directory. Re-exports§
Modules§
Structs§
Enums§
Traits§Functions§
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |