多点触摸与单点触摸接口主要区别【转】

简介: 转自:http://blog.csdn.net/eleven_yy/article/details/7723079 上发单点触摸事件 input_report_key(input,ABS_MT_TRACKING_ID,0); input_report_key(input, BTN_TOUCH,...

转自:http://blog.csdn.net/eleven_yy/article/details/7723079

上发单点触摸事件

input_report_key(input,ABS_MT_TRACKING_ID,0);

input_report_key(input, BTN_TOUCH, 1);

input_report_abs(input, ABS_MT_POSITION_X, ts->tc.x1);

input_report_abs(input, ABS_MT_POSITION_Y, ts->tc.y1);

input_sync(input);

上发多点触摸事件

input_report_key(input,ABS_MT_TRACKING_ID,0); // ABS_MT_TRACKING_ID 用来区分是第几指上报上来的坐标

input_report_key(input, BTN_TOUCH, 1);

input_report_abs(input, ABS_MT_POSITION_X, ts->tc.x1);

input_report_abs(input, ABS_MT_POSITION_Y, ts->tc.y1);

input_mt_sync(input);

 

input_report_key(input,ABS_MT_TRACKING_ID,1);

input_report_key(input, BTN_TOUCH, 1);

input_report_abs(input, ABS_MT_POSITION_X, ts->tc.x2);

input_report_abs(input, ABS_MT_POSITION_Y, ts->tc.y2);

input_mt_sync(input);

input_sync(input);

 

在 2.36.28/29 的 input 模块 中增加多点触摸的接口

 

增加多点触摸的命令定义:

linuxsrc/include/input.h

 


#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */

#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */

#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */

#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */

#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */

#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */

#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */

#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */

#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */

#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */

#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */

 

 

 

/*

* MT_TOOL types

*/

#define MT_TOOL_FINGER 0

#define MT_TOOL_PEN 1

 


在同一文件中增加相应的处理函数:

static inline void input_mt_sync(struct input_dev *dev)

{

input_event(dev, EV_SYN, SYN_MT_REPORT, 0);

}

在linuxsrc/driver/input/input.c 中增加定义

/*

* EV_ABS events which should not be cached are listed here.

*/

static unsigned int input_abs_bypass_init_data[] __initdata = {

ABS_MT_TOUCH_MAJOR,

ABS_MT_TOUCH_MINOR,

ABS_MT_WIDTH_MAJOR,

ABS_MT_WIDTH_MINOR,

ABS_MT_ORIENTATION,

ABS_MT_POSITION_X,

ABS_MT_POSITION_Y,

ABS_MT_TOOL_TYPE,

ABS_MT_BLOB_ID,

ABS_MT_TRACKING_ID,

ABS_MT_PRESSURE,

0

};

【作者】 张昺华
【新浪微博】 张昺华--sky
【twitter】 @sky2030_
【facebook】 张昺华 zhangbinghua
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
目录
相关文章
|
3天前
|
数据采集 人工智能 安全
|
12天前
|
云安全 监控 安全
|
4天前
|
自然语言处理 API
万相 Wan2.6 全新升级发布!人人都能当导演的时代来了
通义万相2.6全新升级,支持文生图、图生视频、文生视频,打造电影级创作体验。智能分镜、角色扮演、音画同步,让创意一键成片,大众也能轻松制作高质量短视频。
1046 151
|
4天前
|
编解码 人工智能 机器人
通义万相2.6,模型使用指南
智能分镜 | 多镜头叙事 | 支持15秒视频生成 | 高品质声音生成 | 多人稳定对话
|
17天前
|
机器学习/深度学习 人工智能 自然语言处理
Z-Image:冲击体验上限的下一代图像生成模型
通义实验室推出全新文生图模型Z-Image,以6B参数实现“快、稳、轻、准”突破。Turbo版本仅需8步亚秒级生成,支持16GB显存设备,中英双语理解与文字渲染尤为出色,真实感和美学表现媲美国际顶尖模型,被誉为“最值得关注的开源生图模型之一”。
1732 9
|
9天前
|
人工智能 自然语言处理 API
一句话生成拓扑图!AI+Draw.io 封神开源组合,工具让你的效率爆炸
一句话生成拓扑图!next-ai-draw-io 结合 AI 与 Draw.io,通过自然语言秒出架构图,支持私有部署、免费大模型接口,彻底解放生产力,绘图效率直接爆炸。
683 152
|
11天前
|
人工智能 安全 前端开发
AgentScope Java v1.0 发布,让 Java 开发者轻松构建企业级 Agentic 应用
AgentScope 重磅发布 Java 版本,拥抱企业开发主流技术栈。
646 12
|
6天前
|
SQL 自然语言处理 调度
Agent Skills 的一次工程实践
**本文采用 Agent Skills 实现整体智能体**,开发框架采用 AgentScope,模型使用 **qwen3-max**。Agent Skills 是 Anthropic 新推出的一种有别于mcp server的一种开发方式,用于为 AI **引入可共享的专业技能**。经验封装到**可发现、可复用的能力单元**中,每个技能以文件夹形式存在,包含特定任务的指导性说明(SKILL.md 文件)、脚本代码和资源等 。大模型可以根据需要动态加载这些技能,从而扩展自身的功能。目前不少国内外的一些框架也开始支持此种的开发方式,详细介绍如下。
409 4