Crate evdev_rs [−] [src]
Rust bindings to libevdev, an wrapper for evdev devices.
This library intends to provide a safe interface to the libevdev library. It will look for the library on the local system, and link to the installed copy.
Examples
Intializing a evdev device
use evdev_rs::Device; use std::fs::File; let f = File::open("/dev/input/event0").unwrap(); let mut d = Device::new().unwrap(); d.set_fd(&f).unwrap();
Getting the next event
use evdev_rs::Device; use std::fs::File; let f = File::open("/dev/input/event0").unwrap(); let mut d = Device::new().unwrap(); d.set_fd(&f).unwrap(); loop { let a = d.next_event(evdev_rs::NORMAL | evdev_rs::BLOCKING); match a { Ok(k) => println!("Event: time {}.{}, ++++++++++++++++++++ {} +++++++++++++++", k.1.time.tv_sec, k.1.time.tv_usec, k.1.event_type), Err(e) => (), } }
Modules
enums | |
logging | |
util |
Structs
AbsInfo |
used by EVIOCGABS/EVIOCSABS ioctls |
Device |
Opaque struct representing an evdev device |
DeviceId | |
InputEvent |
The event structure itself |
ReadFlag | |
TimeVal |
Enums
GrabMode | |
LedState | |
ReadStatus |
Constants
BLOCKING |
The fd is not in O_NONBLOCK and a read may block |
FORCE_SYNC |
Pretend the next event is a SYN_DROPPED and require the caller to sync |
NORMAL |
Process data in normal mode |
SYNC |
Process data in sync mode |