如何读取 ⼀dev⼀input 下的键盘鼠标事件

2025-03-10 16:05:15
推荐回答(1个)
回答1:

[root@localhost device]# cat /sys/class/input/event1/device/name
Macintosh mouse button emulation
[root@localhost device]# cat /sys/class/input/event2/device/name
AT Translated Set 2 keyboard
[root@localhost device]# cat /sys/class/input/event3/device/name
ImPS/2 Generic Wheel Mouse

读出名字进行比较。因为这些名字都是固定的