RK3288 USB触摸屏(hid设备)无法使用,需要添加PID和VID

 RK3288  Android5.1

 

现象:USB 接口触摸屏插到板子上,触摸屏无法使用,有可能出现更奇葩的,同一套代码,有的板子可以用,有的板子不能用。

 

1、打开串口调试,插上触摸屏,读取触摸屏的 PID(idVendor) 和 VID(idProduct)。

[   37.456833] usb 3-1.1.1: new full-speed USB device number 4 using usb20_host
[   37.558583] usb 3-1.1.1: New USB device found, idVendor=1ff7, idProduct=0013
[   37.558785] usb 3-1.1.1: New USB device strings: Mfr=1, Product=0, SerialNumber=0
[   37.558915] usb 3-1.1.1: Manufacturer: CVTouch
[   37.588785] input: CVTouch as /devices/ff540000.usb/usb3/3-1/3-1.1/3-1.1.1/3-1.1.1:1.0/input/input4
[   37.593900] hid-multitouch 0003:1FF7:0013.0001: input,hiddev0,hidraw0: USB HID v1.11 Pointer [CVTouch] on usb-ff540000.usb-1.1.1/input0

 

2、在 hid-ids.h 文件中定义此触摸屏的 PID 和 VID。

diff --git a/kernel/drivers/hid/hid-ids.h b/kernel/drivers/hid/hid-ids.h
index 45c593d..fe49ad2 100755
--- a/kernel/drivers/hid/hid-ids.h
+++ b/kernel/drivers/hid/hid-ids.h
@@ -235,9 +235,6 @@
 #define USB_VENDOR_ID_CREATIVELABS     0x041e
 #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
+ 
+#define USB_VENDOR_ID_CVTOUCH          0x1ff7
+#define USB_DEVICE_ID_CVTOUCH_SCREEN   0x0013

 #define USB_VENDOR_ID_CYGNAL           0x10c4
 #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X      0x818a

 

3、将定义的 PID 和 VID 添加到 HID 特殊设备数组中。

diff --git a/kernel/drivers/hid/hid-core.c b/kernel/drivers/hid/hid-core.c
index 2bd798a..250fc52 100755
--- a/kernel/drivers/hid/hid-core.c
+++ b/kernel/drivers/hid/hid-core.c
@@ -2223,6 +2223,7 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) },
        { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) },
        { }
 };

 

4、在多点触摸模块的 mt_devices 数组中加入 id,即可支持此触摸屏

diff --git a/kernel/drivers/hid/hid-multitouch.c b/kernel/drivers/hid/hid-multitouch.c
old mode 100755
new mode 100644
index fb9ac12..52ef0ba
--- a/kernel/drivers/hid/hid-multitouch.c
+++ b/kernel/drivers/hid/hid-multitouch.c
@@ -1414,6 +1414,11 @@ static const struct hid_device_id mt_devices[] = {
                MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
                        USB_DEVICE_ID_ZYTRONIC_ZXY100) },
 
+       /* TOUCH panels */
+       { .driver_data = MT_CLS_DEFAULT,
+               MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
+                       USB_DEVICE_ID_CVTOUCH_SCREEN) },
+
        /* Generic MT device */
        { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
        { }

 

posted @ 2018-06-22 10:27  LeeAaron  阅读(4488)  评论(1编辑  收藏  举报