evtest [--grab] /dev/input/eventX
evtest --query /dev/input/eventX <type> <value>
If the --grab flag is given in capture mode, evtest keeps an EVIOCGRAB on the device. While this grab is active, other processes will not receive events from the kernel devices. The grab is released again when evtest quits.
In the second invocation type ("query mode"), evtest performs a one-shot query of the state of a specific key value of an event type.
type is one of: EV_KEY, EV_SW, EV_SND, EV_LED (or the numerical value)
value can be either a decimal representation (e.g. 44), hex (e.g. 0x2c), or the constant name (e.g. KEY_Z) of the key/switch/sound/LED being queried.
If the state bit is set (key pressed, switch on, ...), evtest exits with code 10. If the state bit is unset (key depressed, switch off, ...), evtest exits with code 0. No other output is generated.
evtest needs to be able to read from the device; in most cases this means it must be run as root.
evtest is commonly used to debug issues with input devices in X.Org. The output of evtest shows the information presented by the kernel; based on this information it can be determined whether a bug may be a kernel or an X.Org issue.
The following command shows the processes with an open file descriptor on the device:
fuser -v /dev/input/eventX
When used to query state, evtest returns 0 if the state bit is unset and 10 if the state bit is set.
This manual page was written by Stephen Kitt <firstname.lastname@example.org>, based on that present in the lineakd package, for the Debian GNU/Linux system (but may be used by others).