evdev.list

evdev

list() -> devices

Open every stick and gamepad

Returns the open, non-blocking devices under /dev/input that looks_like_stick accepts, in node number order: list()[1] is the lowest-numbered stick. A node the process cannot open is skipped, so with nothing attached the list is empty.

A device ignored accepts is left out. open on its path still opens it.

looks_like_stick and ignored run on each node's capabilities first, and only a node that passes is opened. A close waits out an RCU grace period, tens of milliseconds on some kernels. So a node turned down costs one sysfs read and no close.