700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > linux input设备冲突 linux input设备怎么固定event handler

linux input设备冲突 linux input设备怎么固定event handler

时间:2023-02-05 01:30:43

相关推荐

linux input设备冲突 linux input设备怎么固定event handler

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

/ #

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。