evdev.open

evdev

open(path, nonblock) -> dev, err, errno

Open one input device

Opens path, non-blocking unless nonblock is false, and reads the device's identity and capabilities once. Returns nil, an error and the errno when the node does not open, and when it answers no identity: a regular file refuses with ENOTTY.

fielddescription
dev.paththe node's path
dev.info{ name, bustype, vendor, product, version }
dev.axesABS code to { code, value, min, max, fuzz, flat, resolution }
dev.buttonsthe set of EV_KEY codes the device reports
methoddescription
dev:read()the pending events, each { type, code, value }; an empty table when none wait; nil, an error and the errno when the device is gone
dev:fileno()the descriptor, for lev.core.wait_readable
dev:close()close the node; safe to call twice

One read returns up to 64 events.