使用 evtest 时无法获取鼠标 move 事件测试输入事件的工具。
我只得到三个鼠标事件:
left click event: type = EV_KEY, code = 272 (LeftBtn), value=1/0
right click event: type = EV_KEY, code = 273 (RightBtn), value = 1/0
mouse wheel event: type = EV_REL, code = 8 (Wheel), value = -1
没有鼠标 move 事件。那么我的鼠标 move 事件在哪里以及如何捕获它?
ps:在安装了 virtualBox-addition 的 VirtualBox-4 中的 Ubuntu 11.04
和 Gentoo
上测试。
最佳答案
如果不是在嵌入式 linux 系统上,我更喜欢使用 input-utils 工具而不是 evtest(如果我在 Android 上,我会使用 cat/proc/bus/input/devices
和 getevent
)
通过以下方式安装 input-utils:
$ sudo apt-get install input-utils
列出我所有的输入设备
$ sudo lsinput
/dev/input/event0
bustype : BUS_HOST
vendor : 0x0
product : 0x5
version : 0
name : "Lid Switch"
..
..
phys : "isa0060/serio1/input0"
bits ev : EV_SYN EV_KEY EV_ABS
/dev/input/event12
bustype : BUS_I8042
vendor : 0x2
product : 0xa
version : 0
name : "TPPS/2 IBM TrackPoint"
phys : "synaptics-pt/serio0/input0"
bits ev : EV_SYN EV_KEY EV_REL
然后我在笔记本电脑的跟踪点上读取事件(不要忘记在开始输入事件后 move 它)
$ sudo input-events 12
/dev/input/event12
bustype : BUS_I8042
vendor : 0x2
product : 0xa
version : 0
name : "TPPS/2 IBM TrackPoint"
phys : "synaptics-pt/serio0/input0"
bits ev : EV_SYN EV_KEY EV_REL
waiting for events
16:43:46.516075: EV_REL REL_Y -1
16:43:46.516090: EV_SYN code=0 value=0
16:43:46.539642: EV_REL REL_X -1
16:43:46.539656: EV_REL REL_Y -1
16:43:46.539660: EV_SYN code=0 value=0
16:43:46.704385: EV_REL REL_Y -1
16:43:46.704401: EV_SYN code=0 value=0
关于linux - 无法从/dev/input/event* 获取鼠标 move 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5949631/