当前位置:网站首页>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位置触摸才正确
边栏推荐
- How js implements array deduplication (7 kinds)
- 力扣刷题记录8.1-----206. 反转链表
- Programmer's Daily Life | Daily Fun
- Phenomenon 1 during RF debugging
- Z-Game on grid
- 力扣刷题记录--常用功能函数
- Data recovery software EasyRecovery supports recovery of all types of files
- JDBC technology (3) - use Druid database connection pool test
- Summary of pytorch related knowledge points
- Simple example of .reduce()
猜你喜欢

The last exam before the NPDP revision!caution

【云计算】XaaS最全介绍(按24字母合集):AaaS、BaaS、CaaS、DaaS、EaaS、FaaS、GaaS、HaaS、IDaaS…

电磁辐射安全标准及检测方法

js实现数组去重的方式(7种)

mysql 5.7 入坑

MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor

力扣刷题记录10.1-----19. 删除链表的倒数第 N 个结点

MT4 / MQ4L entry to the master of EA tutorial lesson two (2) - - MQL language commonly used function account information commonly used functions

Maya engine modeling

Programmer's Daily Life | Daily Fun
随机推荐
Design of Go-7-RESTful API
嵌入式设备驱动开发
2022 PMP Project Management Certification Exam Registration Guide (1)
17.flink Table Api基础概念讲解
HCIP-R&S By Wakin自用笔记(3)OSPF之各类LSA及LSA更新规则
终于有人把灰度发布架构设计讲明白了
Open3D 均匀采样
力扣刷题记录8.1-----206. 反转链表
Go - 9 - data type - function
The security of the pension insurance?Reliable?
考研人总结的时间管理7大忌,你中了几条?
MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function
史上最猛“员工”,疯狂吐槽亿万富翁老板小扎:那么有钱,还总穿着同样的衣服!
力扣刷题记录4.1-----209. 长度最小的子数组
RF调试过程中现象一
18.flink Table/Sql API之 catlog
Likou Brush Question Record 5.1-----59. Spiral Matrix II
使网络安全威胁风险更高和成本更高的五个趋势
历史最全DL相关书籍、课程、视频、论文、数据集、会议、框架和工具整理分享
企业从云服务的承诺支出中获得最大收益的四种方法