http://blog.csdn.net/zuosifengli/article/details/7398661

Android 中多点触摸协议:

参考: http://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt

1, 两种多点触摸协议:

1)A类: 处理无关联的接触: 用于直接发送原始数据;

B类: 处理跟踪识别类的接触: 通过事件slot发送相关联的独立接触更新。

2,  触摸协议的使用:

A类协议:

A类协议在每发送完一个接触数据包后会调用 input_mt_sync() 声明 一次数据的结束; input_mt_sync() 会发出一个 SYN_MT_REPORT

提示接收器接收数据并准备下一次数据的接收。

B类协议:

与A类协议不同的是, B类在使用input_mt_slot()的时候会带有一个slot的参数,在每个数据包开始时 产生一个ABS_MT_SLOT事件,提示接收器更新数据。

最终A,B类协议均会调用 input_sync();

A类与B类协议不同的在于: B类协议 通过B类协议 slot 协议需要是用到ABS_MT_TRACKING_ID------ 可以从硬件上获取,或者从原始数据中计算。

3, B类协议:  ABS_MT_TRACKING_ID  表示一次接触;  -1 代表一个不用的slot;

使用参考例子:

释放事件:

input_mt_slot(data->input_dev, i);
                      input_mt_report_slot_state(data->input_dev, MT_TOOL_FINGER, false);        ---------------释放

点击事件:

input_mt_slot(data->input_dev, i);
                      input_mt_report_slot_state(data->input_dev, MT_TOOL_FINGER, true);
                      input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, 1);
                      input_report_abs(data->input_dev, ABS_MT_POSITION_X,  current_events[i].x);
                      input_report_abs(data->input_dev, ABS_MT_POSITION_Y,  current_events[i].y)

补充: 不同事件的标记: 备忘。

ABS_MT_TOUCH_MAJOR

The length of the major axis of the contact. The length
should be given insurface units. If the surface has an X times Y
resolution, the largestpossible value of ABS_MT_TOUCH_MAJOR is sqrt(X^2 +
Y^2), the diagonal [4].

ABS_MT_TOUCH_MINOR

The length, in surface units, of the minor axis of the
contact. If thecontact is circular, this event can be omitted [4].

ABS_MT_WIDTH_MAJOR

The length, in surface units, of the major axis of the
approachingtool. This should be understood as the size of the tool
itself. Theorientation of the contact and the approaching tool are
assumed to be thesame [4].

ABS_MT_WIDTH_MINOR

The length, in surface units, of the minor axis of the
approachingtool. Omit if circular [4].The above four values can be used
to derive additional information aboutthe contact. The ratio
ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximatesthe
notion of pressure. The fingers of the hand and the palm all
havedifferent characteristic widths [1].

ABS_MT_PRESSURE

The pressure, in arbitrary units, on the contact area.
May be used insteadof TOUCH and WIDTH for pressure-based devices or any
device with a spatialsignal intensity distribution.

ABS_MT_DISTANCE

The distance, in surface units, between the contact and
the surface. Zerodistance means the contact is touching the surface. A
positive number meansthe contact is hovering above the surface.

ABS_MT_ORIENTATION

The orientation of the ellipse. The value should describe a
signed quarterof a revolution clockwise around the touch center. The
signed value rangeis arbitrary, but zero should be returned for a finger
aligned along the Yaxis of the surface, a
negative value when finger is turned to the left, anda positive value
when finger turned to the right. When completely aligned withthe X axis,
the range max should be returned. Orientation can be omittedif the
touching object is circular, or if the information
is not availablein the kernel driver. Partial orientation support is
possible if the devicecan distinguish between the two axis, but not
(uniquely) any values inbetween. In such cases, the range of
ABS_MT_ORIENTATION should be [0, 1][4].

ABS_MT_POSITION_X

The surface X coordinate of the center of the touching
ellipse.ABS_MT_POSITION_YThe surface Y coordinate of the center of the
touching ellipse.

ABS_MT_TOOL_TYPE

The type of approaching tool. A lot of kernel drivers
cannot distinguishbetween different tool types, such as a finger or a
pen. In such cases, theevent should be omitted. The protocol currently
supports MT_TOOL_FINGER andMT_TOOL_PEN [2]. For
type B devices, this event is handled by input core;drivers should
instead use input_mt_report_slot_state().

ABS_MT_BLOB_ID

The BLOB_ID groups several packets together into one
arbitrarily shapedcontact. The sequence of points forms a polygon which
defines the shape ofthe contact. This is a low-level anonymous grouping
for type A devices, andshould not be confused
with the high-level trackingID [5]. Most type Adevices do not have blob
capability, so drivers can safely omit this event.

ABS_MT_TRACKING_ID

The TRACKING_ID identifies an initiated contact throughout
its life cycle[5]. The value range of the TRACKING_ID should be large
enough to ensureunique identification of a contact maintained over an
extended period oftime. For type B devices,
this event is handled by input core; driversshould instead use
input_mt_report_slot_state().

Android 中多点触摸协议的更多相关文章

  1. Linux/Android多点触摸协议

    链接点击打开链接 关于Linux多点触摸协议大家可以参考kernel中的文档:https://www.kernel.org/doc/Documentation/input/multi-touch-pr ...

  2. 内核中的多点触摸协议文档 Multi【转】

    转自:http://www.arm9home.net/read.php?tid=24754 前段时间改写了一个GT801的内核驱动,仔细阅读 MT Event 上报的时候,发现这个驱动是针对 Andr ...

  3. Linux与Android 多点触摸协议【转】

    本文转载自:http://blog.csdn.net/xubin341719/article/details/7833277 一.Linux与Android 多点触摸协议 为了使用功能强大的多点触控设 ...

  4. Linux & Android 多点触摸协议

    Linux & Android 多点触摸协议 Android4.0多点触摸入门 1 KERNEL 对于触摸屏的驱动我们简单的划分为两个主要的部分,一个是注册,另一个是上报. 1.1 注册 单点 ...

  5. Linux/Android多点触摸协议【转】

    本文转载自: 链接点击打开链接 关于Linux多点触摸协议大家可以参考kernel中的文档:https://www.kernel.org/doc/Documentation/input/multi-t ...

  6. CTP多点触摸协议【转】

    转自:http://blog.chinaunix.net/uid-26403844-id-5063920.html linux kernel 2.6.30开始对多点触摸支持,最近高通要求所有CTP器件 ...

  7. 毫无保留开源我写的:IOS Android Ipad 多点触摸通用js 库

    毫无保留开源我写的:IOS Android Ipad 多点触摸通用js 库 在线演示地址: http://m.yunxunmi.com/ 支持 IOS Android Ipad 等不同操作系统的手持或 ...

  8. Linux Android 多点触摸协议 原文出自【比特网】,转载请保留原文链接:http://soft.chinabyte.com/os/71/12306571.shtml

    为了使用功能强大的多点触控设备,就需要一种方案去上报用户层所需的详细的手指触摸数据.这个文档所描述的多点触控协议可以让内核驱动程序向用户层上报任意多指的数据信息. 使用说明 单点触摸信息是以ABS承载 ...

  9. Android中使用http协议访问网络

    HTTP协议的工作原理:客户端向服务器端发送http请求,服务器端收到请求后返回一下数据给客户端,客户端接受消息并进行解析. 在Android中发送http请求的方式有两种,第一种是通过HttpURL ...

随机推荐

  1. Spring组件扫描<context:component-scan/>使用详解

    1.如果不想在xml文件中配置bean,我们可以给我们的类加上spring组件注解,只需再配置下spring的扫描器就可以实现bean的自动载入. <!-- 注解注入 --> <co ...

  2. RMAN 完全恢复

    OS:ORACLE-LINUX 5.7 DB:11.2.0.3.0 完全恢复 查看现有的数据文件SQL> select name from v$datafile; NAME----------- ...

  3. Java之HttpURLConnection的变态事: Keep-Alive

    HttpURLConnection的变态事: Keep-Alive JDK自带的HttpURLConnection默认启动Keep-Alive, 使用后的HttpURLConnection会放入池里重 ...

  4. 读TCP-IP详解卷1:协议(1)

    1.TCP传给IP的数据单元称作TCP报文段或简称为TCP段(TCP segment)IP传给网络接口层的数据单元称作IP数据报(IPdatagram).通过以太网传输的比特流称作帧(Frame).

  5. cocos2dx中帧循环的伪代码实现

    1.在游戏开发中,帧率很大程度上体现了游戏的流畅度,帧循环是游戏中一个很重要的概念 2.下面用伪代码实现了cocos2dx中的帧循环 /*main函数调用*/ CCApplication::share ...

  6. heap size eclipse 堆内存

    可以根据eclipse 或 myeclipse heapstats 使用情况调整堆内存大小,heap size 设置,-vmargs-Xms256-Xmx1024 ,其中Xms表示初始值,Xmx表示最 ...

  7. Android下写一个永远不会被KILL掉的进程/服务

    Android 系统对于内存管理有自己的一套方法,为了保障系统有序稳定的运信,系统内部会自动分配,控制程序的内存使用.当系统觉得当前的资源非常有限的时候,为了保证一些优先级高的程序能运行,就会杀掉一些 ...

  8. Notes of the scrum meeting(11/2)

    meeting time:13:00~13:30p.m.,November 2nd,2013 meeting place:3号公寓楼一层 attendees: 顾育豪                  ...

  9. 团队开发——Alpha版总结会议

    本组目前存在的问题: 1.在选题的时候,题目选的比较有难度,造成后期工作量较大,实现有难度(未能正确估计项目的难度). 2.最初规划时,设计的功能较多,但是技术水平达不到,导致目前完成功能较少. 3. ...

  10. cacti手册选译(1)

    第一章 系统需求 Cacti需要你的系统安装一下软件: RRDTool版本1.0.49及以上,推荐1.4+ MYSQL5.x及以上版本 PHP5.1及以上 支持PHP的web Server如Apach ...