RK3288 android7.1 修改双屏异触usb tp触摸方向

2023-10-08 20:04

本文主要是介绍RK3288 android7.1 修改双屏异触usb tp触摸方向,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一,问题描述:

android机器要求接两个屏(lvds+mipi)两个usb tp要实现双屏异触。由于mipi的方向和lvds方向转成一样的了。两个usb tp的方向在异显示的时候也要作用一样。这个时候要根据pid和vid修改触摸上报的数据。usb tp有通用的触摸驱动/kernel/drivers/hid/hid-multitouch.c
即通过vid pid区分!

二,修改方法:

1. device/rockchip/rk3288/下添加idc文件:
Vendor_222a_Product_0001.idc#*****************************************************
# Input Device Configuration File for the generaltouch touch screen.
#*****************************************************# Basic Parameters
touch.deviceType = touchScreen
touch.orientationAware = 1keyboard.layout = qwerty
keyboard.characterMap = qwerty
keyboard.orientationAware = 1
keyboard.builtIn = 1cursor.mode = navigation
cursor.orientationAware = 1device.internal = 0
Vendor_0457_Product_0819.idc#*****************************************************
# Input Device Configuration File for the generaltouch touch screen.
#*****************************************************# Basic Parameters
touch.deviceType = touchScreen
touch.orientationAware = 1keyboard.layout = qwerty
keyboard.characterMap = qwerty
keyboard.orientationAware = 1
keyboard.builtIn = 1cursor.mode = navigation
cursor.orientationAware = 1device.internal = 1
2. device/rockchip/rk3288/device.mk,拷贝到系统中:
# for usb tp
PRODUCT_COPY_FILES += \device/rockchip/rk3288/Vendor_222a_Product_0001.idc:system/usr/idc/Vendor_222a_Product_0001.idc \device/rockchip/rk3288/Vendor_0457_Product_0819.idc:system/usr/idc/Vendor_0457_Product_0819.idc
3. kernel/drivers/hid/hid-multitouch.c修改驱动:
diff --git a/kernel/drivers/hid/hid-multitouch.c b/kernel/drivers/hid/hid-multitouch.c
old mode 100644new mode 100755
index 9de379c1b3..b8456b1e50
--- a/kernel/drivers/hid/hid-multitouch.c
+++ b/kernel/drivers/hid/hid-multitouch.c
@@ -98,7 +98,23 @@ struct mt_fields {unsigned usages[HID_MAX_FIELDS];unsigned int length;
};
-
+#define GTP_SWAP(x, y)                 do{\
+                                         typeof(x) z = x;\
+                                         x = y;\
+                                         y = z;\
+                                       }while (0)
+                              
+#define MAINmGtpChange_X2Y   1 
+#define MIANmGtp_X_Reverse    1
+#define MAINNmGtp_Y_Reverse      0 
+static int  MAINX_max=0;
+static int  MAINY_max=0;
+                              
+#define AUXmGtpChange_X2Y    1 
+#define AUXmGtp_X_Reverse    1
+#define AUXNmGtp_Y_Reverse   0 
+static int  AUXX_max=0;
+static int  AUXY_max=0;
struct mt_device {struct mt_slot curdata; /* placeholder of incoming data */struct mt_class mtclass;    /* our mt device class */
@@ -461,6 +477,14 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,case HID_UP_GENDESK:switch (usage->hid) {case HID_GD_X:
+       if (hdev->vendor==0x0457 && hdev->product==0x0819)
+       {
+           MAINX_max =     field->logical_maximum;+       }
+       else if (hdev->vendor==0x222a && hdev->product ==0x0001)
+       {
+           AUXX_max =  field->logical_maximum;
+       }if (prev_usage && (prev_usage->hid == usage->hid)) {hid_map_usage(hi, usage, bit, max,EV_ABS, ABS_MT_TOOL_X);
@@ -476,6 +500,14 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,mt_store_field(usage, td, hi);return 1;case HID_GD_Y:
+       if (hdev->vendor==0x0457 && hdev->product==0x0819)
+       {
+           MAINY_max =     field->logical_maximum;
+       }
+       else if (hdev->vendor==0x222a && hdev->product ==0x0001)
+       {
+           AUXY_max =  field->logical_maximum;
+       }if (prev_usage && (prev_usage->hid == usage->hid)) {hid_map_usage(hi, usage, bit, max,EV_ABS, ABS_MT_TOOL_Y);
@@ -613,8 +645,10 @@ static int mt_compute_slot(struct mt_device *td, struct input_dev *input)* this function is called when a whole contact has been processed,* so that it can assign it to a slot and store the data there*/
-static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
+static void mt_complete_slot(struct mt_device *td, struct input_dev *input,struct hid_device *hid_device)
{
+   
+   if ((td->mtclass.quirks & MT_QUIRK_CONTACT_CNT_ACCURATE) &&td->num_received >= td->num_expected)return;
@@ -649,7 +683,33 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)int major = max(s->w, s->h) >> 1;int minor = min(s->w, s->h) >> 1;
-           input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
+if (hid_device->vendor==0x0457 && hid_device->product==0x0819)
+{
+   #if MAINmGtpChange_X2Y
+       GTP_SWAP(s->x, s->y);
+   #endif
+       if(MIANmGtp_X_Reverse){
+           s->x = MAINX_max -s->x;+       }
+
+       if(MAINNmGtp_Y_Reverse){
+           s->y = MAINY_max - s->y;
+       }
+}
+else if (hid_device->vendor==0x222a && hid_device->product==0x0001)
+{
+   #if AUXmGtpChange_X2Y
+       GTP_SWAP(s->x, s->y);
+   #endif
+       if(AUXmGtp_X_Reverse){
+           s->x = AUXX_max -s->x;
+       }
+
+       if(AUXNmGtp_Y_Reverse){
+           s->y = AUXY_max - s->y;
+       }
+}input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);input_event(input, EV_ABS, ABS_MT_TOOL_X, s->cx);input_event(input, EV_ABS, ABS_MT_TOOL_Y, s->cy);
@@ -752,7 +812,7 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,if (usage->usage_index + 1 == field->report_count) {/* we only take into account the last report. */if (usage->hid == td->last_slot_field)
-               mt_complete_slot(td, field->hidinput->input);
+               mt_complete_slot(td, field->hidinput->input,hid);}}

定义宏参数含义:
define MAINmGtpChange_X2Y 1 //为主屏tp的x和y互换宏定义
define MIANmGtp_X_Reverse 1 //为主屏tp的x反向宏定义
define MAINNmGtp_Y_Reverse 0 //为主屏tp的y反向宏定义
define AUXmGtpChange_X2Y 1 //为副屏tp的x和y互换宏定义
define AUXmGtp_X_Reverse 1 //为副屏tp的x反向宏定义
define AUXNmGtp_Y_Reverse 0 //为副屏tp的y反向宏定义


以上修改在rk3288_7.1上实测有效,其他平台可参考修改,整体实现方法类似。

关于idc文件控制触摸屏的属性可参考链接:Android系统 调试usb接口触摸屏问题

这篇关于RK3288 android7.1 修改双屏异触usb tp触摸方向的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/167676

相关文章

TP-Link PDDNS服将于务6月30日正式停运:用户需转向第三方DDNS服务

《TP-LinkPDDNS服将于务6月30日正式停运:用户需转向第三方DDNS服务》近期,路由器制造巨头普联(TP-Link)在用户群体中引发了一系列重要变动,上个月,公司发出了一则通知,明确要求所... 路由器厂商普联(TP-Link)上个月发布公告要求所有用户必须完成实名认证后才能继续使用普联提供的 D

修改若依框架Token的过期时间问题

《修改若依框架Token的过期时间问题》本文介绍了如何修改若依框架中Token的过期时间,通过修改`application.yml`文件中的配置来实现,默认单位为分钟,希望此经验对大家有所帮助,也欢迎... 目录修改若依框架Token的过期时间修改Token的过期时间关闭Token的过期时js间总结修改若依

MySQL修改密码的四种实现方式

《MySQL修改密码的四种实现方式》文章主要介绍了如何使用命令行工具修改MySQL密码,包括使用`setpassword`命令和`mysqladmin`命令,此外,还详细描述了忘记密码时的处理方法,包... 目录mysql修改密码四种方式一、set password命令二、使用mysqladmin三、修改u

使用Python在Excel中插入、修改、提取和删除超链接

《使用Python在Excel中插入、修改、提取和删除超链接》超链接是Excel中的常用功能,通过点击超链接可以快速跳转到外部网站、本地文件或工作表中的特定单元格,有效提升数据访问的效率和用户体验,这... 目录引言使用工具python在Excel中插入超链接Python修改Excel中的超链接Python

python修改字符串值的三种方法

《python修改字符串值的三种方法》本文主要介绍了python修改字符串值的三种方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学... 目录第一种方法:第二种方法:第三种方法:在python中,字符串对象是不可变类型,所以我们没办法直接

Mysql8.0修改配置文件my.ini的坑及解决

《Mysql8.0修改配置文件my.ini的坑及解决》使用记事本直接编辑my.ini文件保存后,可能会导致MySQL无法启动,因为MySQL会以ANSI编码读取该文件,解决方法是使用Notepad++... 目录Myhttp://www.chinasem.cnsql8.0修改配置文件my.ini的坑出现的问题

TP-LINK/水星和hasivo交换机怎么选? 三款网管交换机系统功能对比

《TP-LINK/水星和hasivo交换机怎么选?三款网管交换机系统功能对比》今天选了三款都是”8+1″的2.5G网管交换机,分别是TP-LINK水星和hasivo交换机,该怎么选呢?这些交换机功... TP-LINK、水星和hasivo这三台交换机都是”8+1″的2.5G网管交换机,我手里的China编程has

两个月冲刺软考——访问位与修改位的题型(淘汰哪一页);内聚的类型;关于码制的知识点;地址映射的相关内容

1.访问位与修改位的题型(淘汰哪一页) 访问位:为1时表示在内存期间被访问过,为0时表示未被访问;修改位:为1时表示该页面自从被装入内存后被修改过,为0时表示未修改过。 置换页面时,最先置换访问位和修改位为00的,其次是01(没被访问但被修改过)的,之后是10(被访问了但没被修改过),最后是11。 2.内聚的类型 功能内聚:完成一个单一功能,各个部分协同工作,缺一不可。 顺序内聚:

如何在运行时修改serialVersionUID

优质博文:IT-BLOG-CN 问题 我正在使用第三方库连接到外部系统,一切运行正常,但突然出现序列化错误 java.io.InvalidClassException: com.essbase.api.base.EssException; local class incompatible: stream classdesc serialVersionUID = 90314637791991

嵌入式方向的毕业生,找工作很迷茫

一个应届硕士生的问题: 虽然我明白想成为技术大牛需要日积月累的磨练,但我总感觉自己学习方法或者哪些方面有问题,时间一天天过去,自己也每天不停学习,但总感觉自己没有想象中那样进步,总感觉找不到一个很清晰的学习规划……眼看 9 月份就要参加秋招了,我想毕业了去大城市磨练几年,涨涨见识,拓开眼界多学点东西。但是感觉自己的实力还是很不够,内心慌得不行,总怕浪费了这人生唯一的校招机会,当然我也明白,毕业