调试过程记录:
基本信息列表:
1. CPU type : RK3399
2. Kernel version : kernel4.4
3. Android version: Android7.1
4. Touch Controller Interface : USB
5. Touch Controller Type:EEti EXC80H80
1、确保kernel的rockchip_defconfigs文件以下的宏打开:
1. CONFIG_INPUT_EVDEV
2. CONFIG_INPUT_UINPUT
3. CONFIG_HIDRAW ( for USB Interface )
4. HID_MULTITOUCH ( USB Interface & Kernel 3.0 upwards )
2、kernel做以下修改(其实这里主要是做TP vid的识别方面的内容):
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index e9ae3d5..02c60e3 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -1449,6 +1449,15 @@ static void evdev_disconnect(struct input_handle *handle)
put_device(&evdev->dev);
}
+static bool evdev_match(struct input_handler *handler, struct input_dev *dev)
+{
+/* Avoid EETI USB touchscreens */
+#define VID_EETI 0x0EEF
+ if ((BUS_USB == dev->id.bustype) && (VID_EETI == dev->id.vendor))
+ return false;
+ return true;
+}
+
static const struct input_device_id evdev_ids[] = {
{ .driver_info = 1 }, /* Matches all devices */
{ }, /* Terminating zero entry */
@@ -1459,6 +1468,7 @@ MODULE_DEVICE_TABLE(input, evdev_ids);
static struct input_handler evdev_handler = {
.event = evdev_event,
.events = evdev_events,
+ .match = evdev_match, /* Added by EETI*/
.connect = evdev_connect,
.disconnect = evdev_disconnect,
.legacy_minors = true,
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 5d11fea..cdb1443 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -809,6 +809,11 @@ static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
if (joydev_dev_is_absolute_mouse(dev))
return false;
+ /* Avoid EETI virtual devices */
+#define VID_EETI 0x0EEF
+ if (( BUS_VIRTUAL == dev->id.bustype) && (VID_EETI == dev->id.vendor))
+ return false;
+
return true;
}
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index b604564..4ec970b 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -1002,6 +1002,18 @@ static void mousedev_disconnect(struct input_handle *handle)
mousedev_destroy(mousedev);
}
+static bool mousedev_match(struct input_handler *handler, struct input_dev *dev)
+{
+/* Avoid EETI USB touchscreens */
+#define VID_EETI 0x0EEF
+ if ((BUS_USB == dev->id.bustype) && (VID_EETI == dev->id.vendor))
+ return false;
+/* Avoid EETI virtual devices */
+ if ((BUS_VIRTUAL == dev->id.bustype) && (VID_EETI == dev->id.vendor))
+ return false;
+ return true;
+}
+
static const struct input_device_id mousedev_ids[] = {
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
@@ -1056,6 +1068,7 @@ MODULE_DEVICE_TABLE(input, mousedev_ids);
static struct input_handler mousedev_handler = {
.event = mousedev_event,
.connect = mousedev_connect,
+ .match = mousedev_match, /* Added by EETI */
.disconnect = mousedev_disconnect,
.legacy_minors = true,
.minor = MOUSEDEV_MINOR_BASE,
3、see uinput under /dev/input/uinput or /dev/uinput
rk3399_all:/ # ls -l /dev/uinput
crw-rw---- 1 system net_bt_stack 10, 223 1970-01-01 00:00 /dev/uinput
4、rk3399_all:/ # ls -l dev/hidraw0
crw------- 1 root root 237, 0 1970-01-01 00:00 dev/hidraw0
5、cat /proc/bus/input/devices
rk3399_all:/ # cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="ff420030.pwm"
P: Phys=gpio-keys/remotectl
S: Sysfs=/devices/platform/ff420030.pwm/input/input0
U: Uniq=
H: Handlers=event0 cpufreq keychord
B: PROP=0
B: EV=3
B: KEY=10 0 3c0000 c0007c010 4000000000 10000 10003010000 787015040408800 1e16c000000000 10000000004ffc
I: Bus=0003 Vendor=0eef Product=c000 Version=0111
N: Name="eGalax Inc. eGalaxTouch P80H80 -1308-06.00.00.00"
P: Phys=u***-fe3e0000.u***-1/input0
S: Sysfs=/devices/platform/fe3e0000.u***/u***2/2-1/2-1:1.0/0003:0EEF:C000.0001/input/input1
U: Uniq=
H: Handlers=cpufreq
B: PROP=2
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=260800000000003
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="rk29-keypad"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/rockchip-key/input/input3
U: Uniq=
H: Handlers=event1 keychord
B: PROP=0
B: EV=3
B: KEY=100000 40008000 1c004000000000 800000000000000
6、Place “eGTouchA.ini” into Android system directory “/data/eGTouchA.ini” where driver would load it.
adb把eGTouchA.ini文件 push进机器的/data/eGTouchA.ini目录。
7、To make eGTouchD driver run from the beginning of system operation. Please put eGTouchD driver into Android system directory “/system/bin”.
adb把eGTouchD文件 push进机器/system/bin目录。
8、[Android 3.0 upwards] Please put file “eGalaxTouch_VirtualDevice.idc” into Android system directory “/system/usr/idc/”
adb把eGalaxTouch_VirtualDevice.idc文件push到机器/system/usr/idc/目录。
【说明】:以上6、7、8的操作可以添加到代码中的device目录,即把这三个文件拷贝到device/rockchip/rk3399/目录,然后修改device.mk文件和在init.tablet.rc文件给eGTouchD赋权限0755:
(我这里遇到个问题就是从windows拷贝这些文件到linux服务器代码上,没有赋权限给文件,编译的时候没法拷贝到对应目录或者拷贝过去了无权限无法运行,这点需要注意一下)
+++ b/device.mk
@@ -44,6 +44,12 @@ PRODUCT_COPY_FILES +=
$(LOCAL_PATH)/hdcp2_tx:/system/bin/hdcp2_tx
$(LOCAL_PATH)/firmware.le:/system/vendor/firmware/hdcp2.fw
+#add by czd for Touch panel:I215FGB01.0 80H80
+PRODUCT_COPY_FILES +=
+ $(LOCAL_PATH)/eGTouchA.ini:/system/etc/eGTouchA.ini
+ $(LOCAL_PATH)/eGTouchD:/system/bin/eGTouchD
+ $(LOCAL_PATH)/eGalaxTouch_VirtualDevice.idc:/system/usr/idc/eGalaxTouch_VirtualDevice.idc
+
9、Modify the file“init.rc” in Android system and add service,我这里修改的是device/rockchip/rk3399/init.tablet.rc,这样机器开机之后就会把eGTouchD服务程序运行起来。
+ #add for eGTouchD by czd 2020-03-05
+ chmod 0755 /system/bin/eGTouchD
+ copy system/etc/eGTouchA.ini /data/eGTouchA.ini
+ chmod 0777 /data/eGTouchA.ini
+ #add end
+service eGTouchD /system/bin/eGTouchD
+ class main
+ user root
+ group root
+ oneshot
+ seclabel u:r:eGTouchD:s0 //这句必须加上
10、解决相关selinux权限的问题(Android5.1以后的安卓版本需要解决)
10.1 修改sepolicy/file_contexts:
+/system/bin/eGTouchD u:object_r:eGTouchD_exec:s0
10.2 添加sepolicy/eGTouchD.te文件,文件内容如下:
type eGTouchD, domain;
type eGTouchD_exec, exec_type, file_type;
init_daemon_domain(eGTouchD)
allow eGTouchD init_tmpfs:file create_file_perms;
allow eGTouchD self:capability { dac_override net_admin net_raw setgid setuid };
allow eGTouchD device:dir { open read };
allow eGTouchD shell:lnk_file { read };
allow eGTouchD rootfs:lnk_file { getattr };
allow eGTouchD socket_device:sock_file { write };
11、安装apk测试
adb install eGalaxCalibrator_v0.11-u***.apk
原作者:平仄散人
|