LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

evtest

Input device event monitor and query tool

TLDR

List all detected input devices
$ sudo evtest
copy
Display events from a specific device
$ sudo evtest /dev/input/event[number]
copy
Grab device exclusively (prevent other apps from receiving events)
$ sudo evtest --grab /dev/input/event[number]
copy
Query state of a specific key or button
$ sudo evtest --query /dev/input/event[number] EV_KEY [KEY_A]
copy

SYNOPSIS

evtest [--grab] /dev/input/eventXevtest --query /dev/input/eventX eventtype eventcode

DESCRIPTION

evtest displays information from input device drivers using the Linux input subsystem. In capture mode, it shows all events supported by the device and then monitors it to display all generated events like key presses, mouse movements, and touch events.In query mode, it performs a one-shot query of the state of a specific key, switch, sound, or LED value.

PARAMETERS

--grab

Grab device exclusively using EVIOCGRAB, preventing other processes from receiving events.
--query device type code
Query state of a specific key/button/switch. Type can be EVKEY, EVSW, EVSND, EVLED or a numeric value. Returns exit code 0 if unset, 10 if set.

CAVEATS

Requires root privileges to read from /dev/input/ devices. Grabbing a device prevents other applications from receiving events until evtest quits.

SEE ALSO

xinput(1), libinput(1)

Copied to clipboard
Kai