[][src]Crate evdev_rs

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::ReadFlag::NORMAL | evdev_rs::ReadFlag::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

device
enums
logging
uinput
util

Structs

AbsInfo

used by EVIOCGABS/EVIOCSABS ioctls

Device

Opaque struct representing an evdev device

DeviceId
InputEvent

The event structure itself

ReadFlag
TimeVal
UInputDevice

Opaque struct representing an evdev uinput device

Enums

GrabMode
LedState
ReadStatus