zoukankan      html  css  js  c++  java
  • Android 中多点触摸协议

    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)

  • 相关阅读:
    获取当前时间的时间戳
    js获取时间戳
    排序(一)冒泡,选择,插入
    MATLAB入门(一)数组
    锐捷客户端下虚拟机VMware无法联网的问题
    C++ Primer 读书笔记
    LA 4329 树状数组入门
    BZOJ 4352 预处理 + DP
    BZOJ 1954 (POJ 3764) Trie的经典应用 求树上最大异或值
    BZOJ 1597 斜率优化
  • 原文地址:https://www.cnblogs.com/0822vaj/p/4202752.html
Copyright © 2011-2022 走看看