您的位置:首页 > 运维架构 > Linux

Linux如何查看与/dev/input目录下的event对应的设备

2015-11-06 12:48 369 查看


1. /dev/input目录

    /dev/input目录下的事件都是在驱动中调用input_register_device(struct input_dev *dev)产生的。如我的盒子的/dev/input目录的内容如下:

[cpp] view
plaincopy

crw-rw---- root     input     13,  64 1970-01-01 08:00 event0  

crw-rw---- root     input     13,  65 1970-01-01 08:00 event1  

crw-rw---- root     input     13,  66 1970-01-01 08:00 event2  

crw-rw---- root     input     13,  67 1970-01-01 08:00 event3  

crw-rw---- root     input     13,  68 1970-01-01 08:00 event4  

crw-rw---- root     input     13,  69 1970-01-01 08:00 event5  

crw-rw---- root     input     13,  70 2013-08-30 09:56 event6  

    每个event将上报指定的事件,如G-Sensor、触摸屏、Mouse、按键等。


2. 与event对应的设备信息

     与event对应的相关设备信息位于/proc/bus/input/devices,例子如下:

[cpp] view
plaincopy

root@android:/ # cat /proc/bus/input/devices  

cat /proc/bus/input/devices  

I: Bus=0019 Vendor=0001 Product=0001 Version=0100  

N: Name="rk29-keypad"  

P: Phys=gpio-keys/input0  

S: Sysfs=/devices/platform/rk29-keypad/input/input0  

U: Uniq=  

H: Handlers=kbd event0 keychord  

B: PROP=0  

B: EV=3  

B: KEY=8000 100000 0 0 0  

  

I: Bus=0019 Vendor=0001 Product=0001 Version=0100  

N: Name="rkxx-remotectl"  

P: Phys=gpio-keys/input0  

S: Sysfs=/devices/platform/rkxx-remotectl/input/input1  

U: Uniq=  

H: Handlers=kbd event1 keychord  

B: PROP=0  

B: EV=3  

B: KEY=c 70110 260000 0 0 0 20100 2000000 7800000 4000a800 1e16c0 19 78000000 10006ffc  

  

I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  

N: Name="coocaa Device coocaa Wireless Device"  

P: Phys=usb-usb20_host-1.3/input2  

S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.2/input/input2  

U: Uniq=  

H: Handlers=sysrq kbd event2 keychord  

B: PROP=0  

B: EV=12001b  

B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe  

B: ABS=700 0  

B: MSC=10  

B: LED=1f  

  

I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  

N: Name="coocaa Device coocaa Wireless Device"  

P: Phys=usb-usb20_host-1.3/input3  

S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.3/input/input3  

U: Uniq=  

H: Handlers=sysrq kbd event3 keychord  

B: PROP=0  

B: EV=12001f  

B: KEY=4837fff 72ff32d bf544446 0 0 1 30f90 8b17c007 ffe77bfa d941dfff febeffdf ffefffff ffffffff fffffffe  
B: REL=40  

B: ABS=ffffff01 0  

B: MSC=10  

B: LED=1f  

  

I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  

N: Name="coocaa Device coocaa Wireless Device"  

P: Phys=usb-usb20_host-1.3/input4  

S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.4/input/input4  

U: Uniq=  

H: Handlers=event4  

B: PROP=0  

B: EV=17  

B: KEY=1f0000 0 0 0 0 0 0 0 0  

B: REL=103  

B: MSC=10  

  

I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  

N: Name="coocaa Device coocaa Wireless Device"  

P: Phys=usb-usb20_host-1.3/input5  

S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.5/input/input5  

U: Uniq=  

H: Handlers=sysrq kbd event5 keychord  

B: PROP=0  

B: EV=12001f  

B: KEY=4837fff 72ff32d bf544446 0 0 1 30f90 8b17c007 ffff7bfa d941dfff febeffdf ffefffff ffffffff fffffffe  

B: REL=40  

B: ABS=1 0  

B: MSC=10  

B: LED=1f  

  

I: Bus=0003 Vendor=093a Product=2510 Version=0111  

N: Name="PixArt USB Optical Mouse"  

P: Phys=usb-usb20_host-1.2.4/input0  

S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.2/2-1.2.4/2-1.2.4:1.0/input/input7  

U: Uniq=  

H: Handlers=event6  

B: PROP=0  

B: EV=17  

B: KEY=70000 0 0 0 0 0 0 0 0  

B: REL=103  

B: MSC=10  

    在上面的H:中可以看到对应的eventxx。

I: Bus=0013 Vendor=dead Product=beef Version=0101

N: Name="fa_ts_input"

P: Phys=input(ts)

S: Sysfs=/devices/virtual/input/input0

U: Uniq=

H: Handlers=mouse0 event0

B: PROP=0

B: EV=b

B: KEY=400 0 0 0 0 1000 40000800 0 0 0 0

B: ABS=1000003

I: Bus=0018 Vendor=12fa Product=7660 Version=0100

N: Name="mma7660"

P: Phys=

S: Sysfs=/devices/platform/s3c2440-i2c.3/i2c-3/3-004c/input/input1

U: Uniq=

H: Handlers=event1

B: PROP=0

B: EV=9

B: ABS=7

在tiny4412中mma7660通过上边的方法可以得知,对应的input的event1;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: