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

简介:

转自: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博客园博客,原文链接:http://www.cnblogs.com/sky-heaven/p/5107993.html,如需转载请自行联系原作者

相关文章
|
7月前
触摸屏工作原理
触摸屏工作原理
197 0
|
8月前
|
前端开发 JavaScript 定位技术
移动端手势事件和触摸交互
移动端手势事件和触摸交互
|
JavaScript 前端开发
封装一个视频组件(可模拟画中画效果)
封装一个视频组件(可模拟画中画效果)
封装一个视频组件(可模拟画中画效果)
|
容器
多点触摸操作
原文:多点触摸操作 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/m0_37591671/article/details/69487226 1.
782 0
多点触控与多鼠标支持
原文:多点触控与多鼠标支持 多点触控与多鼠标支持   最进将工作流平台进行了升级,除了用WF4重新构建了后台,最大的改变就是全部图形化了用户界面 原计划在用户界面中全面启用多点触控技术,但发现多点触控的效果没有想象中的那么绚.
1043 0
|
Linux Android开发
基于Android系统的多点触摸屏(MultiTouchScreen)驱动
理论: 输入子系统由来   在Linux中, 应用层对于输入设备(鼠标、键盘、触摸屏等)的操作无非都是open、read、write、ioctl,然后调用驱动层的xxx_open、xxx_read、xxx_write、xxx_ioctl去操作具体的硬件输入设备。
2040 0