gizhw:evdev
the Linux backend of gizhw:input. Input devices (evdev, /dev/input/eventN): a device's name and ids, and its events as the kernel reports them (struct input_event: 24 bytes on 64-bit). Every call is on a Handle of gizhw:device, so no libc call is here.
import * as Evdev from "gizhw:evdev";Types
Ids
type Ids = { bus: i64; vendor: i64; product: i64; version: i64; }A device's ids: bus, vendor, product and version (struct input_id).
bus:i64vendor:i64product:i64version:i64
Event
type Event = { time: i64; type: i64; code: i64; value: i64; }One event: time in milliseconds, type (EV_SYN 0, EV_KEY 1, EV_REL 2, EV_ABS 3), code and value.
time:i64type:i64code:i64value:i64
Functions
parseIds
function parseIds(data: bytes): IdsThe ids in the 8-byte reply to EVIOCGID.
Effects: fail.
parseEvents
function parseEvents(data: bytes): Vec<Event>The events in data, whole structs only: time (seconds and microseconds, 8 bytes each), type, code (u16 each) and
value (i32).
Effects: fail.
name
function name(h: Device.Handle): string throws stringThe name of the input device behind h.
Effects: fail, io.
ids
function ids(h: Device.Handle): Ids throws stringThe ids of the input device behind h.
Effects: fail, io.
events
function events(h: Device.Handle, count: i64): Vec<Event> throws stringThe next count events, waiting for them.
Effects: fail, io.
inputs
function inputs(sys: System): Vec<Device.Device> throws IoErrorThe event devices of the input class (eventN with a node).
Effects: fail, io.
open
function open(sys: System, node: string): Device.Handle throws stringThe handle on the event device node (read-only is enough for reading events).
Effects: fail, io.