Transferred from: http://blog.csdn.net/eleven_yy/article/details/7723079
On-Billing Point touch event
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);
Up multi-touch events
Input_report_key (input,abs_mt_tracking_id,0); ABS_MT_TRACKING_ID is used to distinguish the coordinates of the first reference.
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);
Adding a multi-touch interface to the input module of the 2.36.28/29
To add a multi-touch command definition:
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 the contact area */
/*
* Mt_tool Types
*/
#define Mt_tool_finger 0
#define Mt_tool_pen 1
Add the appropriate handler function in the same file:
static inline void Input_mt_sync (struct Input_dev *dev)
{
Input_event (Dev, Ev_syn, syn_mt_report, 0);
}
Adding definitions in linuxsrc/driver/input/input.c
/*
* Ev_abs events which should not being cached is 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
};
Multi-touch and Single Touch interface main difference "turn"