分享

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

 dwlinux_gs 2014-08-25

1. /dev/input目录

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

  1. crw-rw---- root     input     13,  64 1970-01-01 08:00 event0  
  2. crw-rw---- root     input     13,  65 1970-01-01 08:00 event1  
  3. crw-rw---- root     input     13,  66 1970-01-01 08:00 event2  
  4. crw-rw---- root     input     13,  67 1970-01-01 08:00 event3  
  5. crw-rw---- root     input     13,  68 1970-01-01 08:00 event4  
  6. crw-rw---- root     input     13,  69 1970-01-01 08:00 event5  
  7. crw-rw---- root     input     13,  70 2013-08-30 09:56 event6  

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

2. 与event对应的设备信息

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

  1. root@android:/ # cat /proc/bus/input/devices  
  2. cat /proc/bus/input/devices  
  3. I: Bus=0019 Vendor=0001 Product=0001 Version=0100  
  4. N: Name="rk29-keypad"  
  5. P: Phys=gpio-keys/input0  
  6. S: Sysfs=/devices/platform/rk29-keypad/input/input0  
  7. U: Uniq=  
  8. H: Handlers=kbd event0 keychord  
  9. B: PROP=0  
  10. B: EV=3  
  11. B: KEY=8000 100000 0 0 0  
  12.   
  13. I: Bus=0019 Vendor=0001 Product=0001 Version=0100  
  14. N: Name="rkxx-remotectl"  
  15. P: Phys=gpio-keys/input0  
  16. S: Sysfs=/devices/platform/rkxx-remotectl/input/input1  
  17. U: Uniq=  
  18. H: Handlers=kbd event1 keychord  
  19. B: PROP=0  
  20. B: EV=3  
  21. B: KEY=c 70110 260000 0 0 0 20100 2000000 7800000 4000a800 1e16c0 19 78000000 10006ffc  
  22.   
  23. I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  
  24. N: Name="coocaa Device coocaa Wireless Device"  
  25. P: Phys=usb-usb20_host-1.3/input2  
  26. S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.2/input/input2  
  27. U: Uniq=  
  28. H: Handlers=sysrq kbd event2 keychord  
  29. B: PROP=0  
  30. B: EV=12001b  
  31. B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe  
  32. B: ABS=700 0  
  33. B: MSC=10  
  34. B: LED=1f  
  35.   
  36. I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  
  37. N: Name="coocaa Device coocaa Wireless Device"  
  38. P: Phys=usb-usb20_host-1.3/input3  
  39. S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.3/input/input3  
  40. U: Uniq=  
  41. H: Handlers=sysrq kbd event3 keychord  
  42. B: PROP=0  
  43. B: EV=12001f  
  44. B: KEY=4837fff 72ff32d bf544446 0 0 1 30f90 8b17c007 ffe77bfa d941dfff febeffdf ffefffff ffffffff fffffffe  
  45. B: REL=40  
  46. B: ABS=ffffff01 0  
  47. B: MSC=10  
  48. B: LED=1f  
  49.   
  50. I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  
  51. N: Name="coocaa Device coocaa Wireless Device"  
  52. P: Phys=usb-usb20_host-1.3/input4  
  53. S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.4/input/input4  
  54. U: Uniq=  
  55. H: Handlers=event4  
  56. B: PROP=0  
  57. B: EV=17  
  58. B: KEY=1f0000 0 0 0 0 0 0 0 0  
  59. B: REL=103  
  60. B: MSC=10  
  61.   
  62. I: Bus=0003 Vendor=0c45 Product=1109 Version=0100  
  63. N: Name="coocaa Device coocaa Wireless Device"  
  64. P: Phys=usb-usb20_host-1.3/input5  
  65. S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.5/input/input5  
  66. U: Uniq=  
  67. H: Handlers=sysrq kbd event5 keychord  
  68. B: PROP=0  
  69. B: EV=12001f  
  70. B: KEY=4837fff 72ff32d bf544446 0 0 1 30f90 8b17c007 ffff7bfa d941dfff febeffdf ffefffff ffffffff fffffffe  
  71. B: REL=40  
  72. B: ABS=1 0  
  73. B: MSC=10  
  74. B: LED=1f  
  75.   
  76. I: Bus=0003 Vendor=093a Product=2510 Version=0111  
  77. N: Name="PixArt USB Optical Mouse"  
  78. P: Phys=usb-usb20_host-1.2.4/input0  
  79. S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.2/2-1.2.4/2-1.2.4:1.0/input/input7  
  80. U: Uniq=  
  81. H: Handlers=event6  
  82. B: PROP=0  
  83. B: EV=17  
  84. B: KEY=70000 0 0 0 0 0 0 0 0  
  85. B: REL=103  
  86. B: MSC=10  

  1. 查看CPU信息:cat /proc/cpuinfo  
  2.   
  3. 查看内存信息:cat /proc/meminfo  
  4.   
  5. 查看USB设备:cat /proc/bus/usb/devices  
  6.   
  7. 查看键盘和鼠标:cat /proc/bus/input/devices  
  8.   
  9. 查看各分区使用情况:df  
  10.   
  11. 查看体系结构:busybox uname -a  
  12.   
  13. 查看中断信息:cat /proc/interrupts  


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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多