天天看点

[RK3399][Android7.1] 调试笔记 --- USB touch开机无法识别问题

Platform: RK3399

OS: Android 7.1

Kernel: v4.4.83

现象:

外接USB touch到板子上, 插到一个USB可以识别,但是另外一个却不行.

分析过程:

  1. 硬件中断可以接收到,说明驱动加载OK
  2. 查看上层[email protected], 它会读取/dev/input目录,却并没有touch对应的event.
  3. [email protected],也确实有和input_dev匹配成功后发送事件到上层
  4. /dev/input/event由ueventd进程创建
  5. 查看log,发现ueventd的创建晚于touch事件发送之后,原因找到

解决方法:

在hid驱动或者usb controller驱动中增加一个延迟,让事件的发送晚于ueventd创建之后.

[email protected]:~/rk3399/kernel$ g df 769bf422e78ea3751378b06863c41140f95b08d5 540dba9cd1a09821e8492275f70617420570fbee
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9028976..37d5f96 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -38,6 +38,10 @@
 
 #include "hid-ids.h"
 
+/*Kris, 190619, Fix issue that touch can't be recognized. */
+#include <linux/delay.h>
+/*Kris, 190619, Fix issue that touch can't be recognized. }*/
+
 /*
  * Version Information
  */
@@ -2162,6 +2166,11 @@ static int hid_device_probe(struct device *dev)
        const struct hid_device_id *id;
        int ret = 0;
 
+       /*Kris, 190619, Fix issue that touch can't be recognized. {*/
+       printk("Sleep 1s to wait ueventd start.\n");
+       msleep(1000);
+       /*Kris, 190619, Fix issue that touch can't be recognized. }*/
           

参考:

Android ueventd浅析

linux input输入子系统分析(input_dev和handler匹配分析)

继续阅读