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.
| field | description |
|---|---|
dev.path | the node's path |
dev.info | { name, bustype, vendor, product, version } |
dev.axes | ABS code to { code, value, min, max, fuzz, flat, resolution } |
dev.buttons | the set of EV_KEY codes the device reports |
| method | description |
|---|---|
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.