加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 无法从/ dev / input / event *获取鼠标移动事件

发布时间:2020-12-14 01:03:18 所属栏目:Linux 来源:网络整理
导读:使用 evtest工具测试输入事件时,我无法获得鼠标移动事件. 我刚刚得到三个鼠标事件: left click event: type = EV_KEY,code = 272 (LeftBtn),value=1/0right click event: type = EV_KEY,code = 273 (RightBtn),value = 1/0mouse wheel event: type = EV_REL
使用 evtest工具测试输入事件时,我无法获得鼠标移动事件.

我刚刚得到三个鼠标事件:

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

没有鼠标移动事件.那么我的鼠标移动事件以及如何捕获它?

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

然后我在我的笔记本电脑的轨迹点上读取事件(不要忘记在启动输入事件后移动它)

$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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读