当前位置:网站首页>USB 触摸在竖屏时校准
USB 触摸在竖屏时校准
2022-08-09 02:21:00 【szembed】
linux-3.10\drivers\hid\hid-multitouch.c
--- hid-multitouch.c_bak 2019-07-05 17:33:23.000000000 +0800
+++ hid-multitouch.c 2020-04-17 09:42:26.076644126 +0800
@@ -68,6 +68,12 @@
#define MT_QUIRK_HOVERING (1 << 11)
#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12)
+static int exchange_x_y_flag = 1;
+static int revert_x_flag = 0;
+static int revert_y_flag = 1;
+
+static int X_max = 0;
+static int Y_max = 0;
struct mt_slot {
__s32 x, y, cx, cy, p, w, h;
__s32 contactid; /* the device ContactID assigned to this slot */
@@ -460,7 +466,8 @@
case HID_UP_GENDESK:
switch (usage->hid) {
- case HID_GD_X:
+ case HID_GD_Y:
+ X_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);
@@ -475,7 +482,9 @@
mt_store_field(usage, td, hi);
return 1;
- case HID_GD_Y:
+ case HID_GD_X:
+ Y_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);
@@ -641,6 +650,15 @@
int major = max(s->w, s->h) >> 1;
int minor = min(s->w, s->h) >> 1;
+ if(1 == exchange_x_y_flag)
+ swap(s->x, s->y);
+
+ if(1 == revert_x_flag)
+ s->x = X_max - (s->x);
+
+ if(1 == revert_y_flag)
+ s->y = Y_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);
之前只交换s->x 和 s->y的数值但是触摸还是没对
之后 HID_GD_X和HID_GD_Y位置触摸才正确
边栏推荐
- 10.1-----19. Delete the Nth node from the bottom of the linked list
- 物联网未来:未来五年的预期
- 历史最全DL相关书籍、课程、视频、论文、数据集、会议、框架和工具整理分享
- 2022 Eye Care Products Exhibition, Beijing Eye Health Exhibition, Ophthalmology Exhibition, Myopia Correction Equipment Exhibition
- 力扣刷题记录7.1-----707. 设计链表
- Open3D 均匀采样
- 中国SSD产业突围有多难?除了技术“瓶颈”还有哪里挑战?
- PMP有什么答题技巧?
- 2022/8/8 Competition thinking + state pressure dp
- Group DETR:分组一对多匹配是加速DETR收敛的关键
猜你喜欢
New Swagger3.0 tutorial, OAS3 quick configuration guide, to automate API interface documentation!
<爆>2022中文版-《海外博士申请指南-材料准备、时间线、套磁、面试及录取》免费分享
最强分布式锁工具:Redisson
ROS2错误:不支持OpenGL 1.5 GLRenderSystem:: ci initialiseContext在C: \ \ ws \构建……
JDBC technology (1) - a simple JDBC test
力扣刷题记录1.5-----367. 有效的完全平方数
MT4/MQL4入门到精通EA教程第一课-MQL语言常用函数(一)OrderSend()函数
Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
JDBC technology (3) - use Druid database connection pool test
企业面临的五大数据安全挑战
随机推荐
2022杭电多校第五场1007(生成函数+启发式合并+ntt)
显著性检验--学习笔记
MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function
Design of Go-7-RESTful API
SQLite切换日志模式优化
Likou Brush Question Record--Common Functions
2022 Eye Health Brand Franchise Exhibition, Beijing Vision Care Exhibition, China Ophthalmology Technology Summit
Likou Brush Question Record 8.1-----206. Reverse linked list
JDBC技术(一)——一个简单的JDBC测试
mysql 5.7 入坑
D. Tournament Countdown
力扣刷题记录--常用功能函数
年金险的安全性怎么样啊?可靠吗?
Appium常用操作及H5页面元素定位
最强分布式锁工具:Redisson
力扣刷题记录8.1-----206. 反转链表
[C language brush questions] Application of fast and slow pointers in linked lists
2022中国眼博会,中国北京国际儿童青少年眼睛健康产业展览会
【izpack】使用izpack为你的程序提供安装程序封装
MT4/MQ4L入门到精通EA教程第二课-MQL语言常用函数(二)-账户信息常用功能函数