Android 中多点触摸协议

转载 2013年12月05日 17:45:16

Android 中多点触摸协议:



1, 两种多点触摸协议:

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

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


2,  触摸协议的使用:


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



                     与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)



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


             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].


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


             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].


            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].


            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.


           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.


           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].


            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.


           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().


            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.


           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().


  • mcgrady_tracy
  • mcgrady_tracy
  • 2015年07月02日 18:22
  • 2606

Android 单点&多点触控实现-----USB接口

Android 单点&多点触控实现-----USB接口   一 单点 1.源码目录\drivers\input\touchscreen\usbtouchscreen.c 按照既有的模板增加即可,上报协...
  • ccclm080524
  • ccclm080524
  • 2014年01月13日 18:25
  • 1801


转自: Android 中多点触摸协议:               ...
  • xishuang_gongzi
  • xishuang_gongzi
  • 2016年05月25日 10:00
  • 216

Android 中多点触摸协议 Android 中多点触摸协议:                 参考...
  • wh_19910525
  • wh_19910525
  • 2013年09月04日 12:29
  • 4894


IBCScaleGestureDetector      多点触控手势接口     DummyScaleGestureDetector 不支持多点触控 ...
  • kelsel
  • kelsel
  • 2016年10月08日 17:34
  • 197

解析Android 中多点触摸的实现方法

  • qq_35600588
  • qq_35600588
  • 2016年09月08日 10:45
  • 385

Linux & Android 多点触摸协议

【导读】:单点触摸信息是以ABS承载并按一定顺序发送,多点触摸信息则是以ABS_MT承载并按一定顺序发送,然后通过调用input_mt_sync()产生一个 SYN_MT_REPORT event来标...
  • liwendovo
  • liwendovo
  • 2012年08月24日 09:26
  • 960

cocos2d3.x android和ios屏蔽多点触摸

ios屏蔽多点触摸比较简单,在 中添加一下代码: [eaglView setMultipleTouchEnabled:YES] 设置为 NO,就是单点触摸。这样就不用...
  • wpj0304
  • wpj0304
  • 2017年03月16日 10:24
  • 1147

TP----Linux & Android 多点触摸协议

Linux & Android 多点触摸协议   2013-02-26 09:23:02|  分类: Android |  标签:tp  多点触摸协议  |字号 订阅 Android4...
  • wujiangguizhen
  • wujiangguizhen
  • 2013年08月30日 16:41
  • 1537

cocos2d-x 3.14关闭安卓多点触摸

在cocos2d-x中创建EventListenerTouchOneByOne,来只用单点触摸。 可是在安卓中,当你同时多指触摸屏幕时,则是多个触摸点,按依次触发来处理。这样并不是我们想要,可能引发...
  • just_do_it2009
  • just_do_it2009
  • 2017年04月21日 07:01
  • 1024
您举报文章:Android 中多点触摸协议