Linux command
evtest 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
List
sudo evtest
Example
sudo evtest /dev/input/event[number]
Grab
sudo evtest --grab /dev/input/event[number]
Query
sudo evtest --query /dev/input/event[number] EV_KEY [KEY_A]
说明
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.
参数
- --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 EV_KEY, EV_SW, EV_SND, EV_LED or a numeric value. Returns exit code 0 if unset, 10 if set.
FAQ
What is the evtest command used for?
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.
How do I run a basic evtest example?
Run `sudo evtest` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --grab do in evtest?
Grab device exclusively using EVIOCGRAB, preventing other processes from receiving events.