免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5795 | 回复: 6
打印 上一主题 下一主题

请问怎么知道/dev/input/eventX对应的是什么设备? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-18 15:59 |只看该作者 |倒序浏览
本帖最后由 sugelawa 于 2013-10-03 14:04 编辑

我需要读取/dev/input/eventX设备的流,但是我怎么知道这些event分别对应什么设备呢?比如哪个是鼠标,哪个是键盘,哪个是触摸屏?有人有idea吗?

论坛徽章:
0
2 [报告]
发表于 2013-09-18 17:42 |只看该作者
[root@localhost ~]# ll /sys/class/input/event1/device/
总计 0
-rw-r--r-- 1 root root 4096 09-18 16:48 bind_mode
lrwxrwxrwx 1 root root    0 09-18 17:17 bus -> ../../../../bus/serio
-r--r--r-- 1 root root 4096 09-18 16:48 description
lrwxrwxrwx 1 root root    0 09-18 17:17 driver -> ../../../../bus/serio/drivers/psmouse
--w------- 1 root root 4096 09-18 16:48 drvctl
drwxr-xr-x 2 root root    0 09-18 16:48 id
lrwxrwxrwx 1 root root    0 09-18 16:48 input:event1 -> ../../../../class/input/input1/event1
看到了吧
中秋快到了,还在工作啊,致敬!
驱动群:
163617970

论坛徽章:
0
3 [报告]
发表于 2013-09-18 17:56 |只看该作者
本帖最后由 sugelawa 于 2013-09-18 17:56 编辑

非常感谢。只要是鼠标的设备一定指向psmouse是吗?另外怎么判断触摸屏呢,在Android上。回复 2# wwxxxxll


   

论坛徽章:
0
4 [报告]
发表于 2013-09-19 22:20 |只看该作者
本帖最后由 sugelawa 于 2013-09-19 22:21 编辑

回复 2# wwxxxxll


这是我得到的信息,不知道如何知道是什么设备(android平板):

root@android:/ # ls -l /sys/class/input/event1/device/                        
drwxr-xr-x root     root              2013-09-19 22:18 capabilities
lrwxrwxrwx root     root              2013-09-19 22:18 device -> ../../../2-0040
drwxr-xr-x root     root              2013-09-19 22:18 event1
drwxr-xr-x root     root              2013-09-19 22:18 id
-r--r--r-- root     root         4096 2013-09-19 22:18 modalias
-r--r--r-- root     root         4096 2013-09-19 22:18 name
-r--r--r-- root     root         4096 2013-09-19 22:18 phys
drwxr-xr-x root     root              2013-09-19 22:18 power
-r--r--r-- root     root         4096 2013-09-19 22:18 properties
lrwxrwxrwx root     root              2013-09-19 22:18 subsystem -> ../../../../../../../class/input
-rw-r--r-- root     root         4096 2013-09-19 22:18 uevent
-r--r--r-- root     root         4096 2013-09-19 22:18 uniq


   

论坛徽章:
0
5 [报告]
发表于 2013-09-22 09:34 |只看该作者
你可以看看那个name
还有就是用
#cat /proc/bus/input/devices
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/class/input/input0
H: Handlers=kbd event0
B: EV=120013
B: KEY=4 2000000 3802078 f840d001 feffffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=7

I: Bus=0011 Vendor=0002 Product=0005 Version=0000
N: Name="ImPS/2 Generic Wheel Mouse"
P: Phys=isa0060/serio1/input0
S: Sysfs=/class/input/input1
H: Handlers=mouse0 event1
B: EV=7
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=103

论坛徽章:
0
6 [报告]
发表于 2013-10-12 17:51 |只看该作者
命令 getevent -p 可以显示出来

怎么只有作者可见呢,

论坛徽章:
0
7 [报告]
发表于 2013-10-19 19:53 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP