linux input如何固定设备event handler

于qt开发时间。遇到的问题,usb输入设备(鼠标器,usb 电容屏)在动力分配后自己主动input节点,实例usb鼠标停留电后,分配给自己的主动性/dev/input/event0 mouse0。第一插头后,加入自己主动节点在未来。变/dev/input/event1mouse1

 

对于鼠标类型的设备。/dev/input/mouseX 的全部消息都会汇总到/dev/input/mice,因此,qt的QWS_MOUSE_PROTO输入能够指定IntelliMouse=/dev/input/mice,鼠标插拔即使mouseX变化也都能使用。

 

可是,对于usb触控类型输入设备,使用的event接口,向应用层汇报的是绝对坐标信息。不是mouse的相对坐标信息,所以当eventX设备号变化后。应用层就无法识别了,由于没有像/dev/input/mice这种接口。而大部分应用触控都使用了tslib。TSLIB_TSDEVICE=/dev/input/event0, 


直接给出须要改动的地方:

共同拥有3处:drivers/input/input.c  input_register_device函数



drivers/input/mousedev.c   mousedev_connect函数



drivers/input/evdev.c  evdev_connect函数



结果例如以下,我的三个设备都固定为event6  event7  event8  ,usb设备随意插拔,event handler也不会变化

/ # 
/ # cat /proc/bus/input/devices 
I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="gt928 Touchscreen"
P: Phys=1-0014/input0
S: Sysfs=/devices/virtual/input/input6
U: Uniq=
H: Handlers=mouse6 event6 
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003


I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="ADS7846 Touchscreen"
P: Phys=spi1.0/input0
S: Sysfs=/devices/platform/omap2_mcspi.1/spi1.0/input/input7
U: Uniq=
H: Handlers=mouse7 event7 
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003


I: Bus=0003 Vendor=0eef Product=0001 Version=0100
N: Name="eGalax Inc. USB TouchController"
P: Phys=usb-ehci-omap.0-1.1/input0
S: Sysfs=/devices/platform/ehci-omap.0/usb1/1-1/1-1.1/1-1.1:1.0/input/input8
U: Uniq=
H: Handlers=mouse8 event8 
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003


/ # 

版权声明:本文博主原创文章,博客,未经同意不得转载。

posted @ 2015-10-02 14:36  zfyouxi  阅读(2571)  评论(0编辑  收藏  举报