zoukankan      html  css  js  c++  java
  • 多点触摸与单点触摸接口主要区别【转】

    转自: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

    };

  • 相关阅读:
    剑桥雅思写作高分范文ESSAY64
    剑桥雅思写作高分范文ESSAY63
    剑桥雅思写作高分范文ESSAY62
    剑桥雅思写作高分范文ESSAY61
    Python特点
    解释器
    python开发时总会碰到的问题
    python redis
    python连接数据库的方法
    数据库中的主键、外键、索引的区别
  • 原文地址:https://www.cnblogs.com/sky-heaven/p/5107993.html
Copyright © 2011-2022 走看看