当前位置:网站首页>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位置触摸才正确
边栏推荐
- 力扣刷题记录1.5-----367. 有效的完全平方数
- 史上最猛“员工”,疯狂吐槽亿万富翁老板小扎:那么有钱,还总穿着同样的衣服!
- pytorch相关知识点总结
- Use of torchversion.transforms
- MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor
- MT4/MQ4L入门到精通EA教程第二课-MQL语言常用函数(二)-账户信息常用功能函数
- MT4/MQL4入门到精通外汇EA教程第一课 认识MetaEditor
- 如何最大限度地减少企业受到供应链攻击的风险
- 低代码开发创新企业应用构建模式
- Latex示例参考
猜你喜欢
电磁辐射安全标准及检测方法
MAYA发动机建模
JDBC技术(二)——设置通用的sql和配置文件
史上最猛“员工”,疯狂吐槽亿万富翁老板小扎:那么有钱,还总穿着同样的衣服!
etcd实现大规模服务治理应用实战
The last exam before the NPDP revision!caution
Force buckled brush problem record 7.1 -- -- -- -- -- 707. The design list
JDBC technology (2) - set up common sql and configuration files
数仓第一篇:基础架构
程序员的日常生活 | 每日趣闻
随机推荐
Go-9-数据类型-函数
2022 Eye Care Products Exhibition, Beijing Eye Health Exhibition, Ophthalmology Exhibition, Myopia Correction Equipment Exhibition
增额终身寿险哪家最好呢?真的安全吗?
How SEMRush finds keywords for advertising
OpenMLDB + Jupyter Notebook:快速搭建机器学习应用
MT4/MQL4入门到精通EA教程第一课-MQL语言常用函数(一)OrderSend()函数
帮助安全红队取得成功的11条建议
ApiFile配置环境
ROS2错误:不支持OpenGL 1.5 GLRenderSystem:: ci initialiseContext在C: \ \ ws \构建……
如何最大限度地减少企业受到供应链攻击的风险
最新工业界推荐系统数据集-召回排序模型原理、结构及代码实战整理分享
2022眼康品牌加盟展,北京视力保健展,中国眼科医学技术峰会
Json之JArray的使用方法
Significance Test--Study Notes
虹科技术|如何阻止供应链攻击?
【云计算】XaaS最全介绍(按24字母合集):AaaS、BaaS、CaaS、DaaS、EaaS、FaaS、GaaS、HaaS、IDaaS…
JDBC technology (2) - set up common sql and configuration files
Phenomenon 1 during RF debugging
为什么应用程序依赖关系映射对于云迁移至关重要
Educational Codeforces Round 132 (Rated for Div. 2)