Android 中多點觸摸協議:事件
參考: http://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txtget
1, 兩種多點觸摸協議:input
1)A類: 處理無關聯的接觸: 用於直接發送原始數據;io
B類: 處理跟蹤識別類的接觸: 經過事件slot發送相關聯的獨立接觸更新。event
2, 觸摸協議的使用:硬件
A類協議:數據
A類協議在每發送完一個接觸數據包後會調用 input_mt_sync() 聲明 一次數據的結束; input_mt_sync() 會發出一個 SYN_MT_REPORT協議
提示接收器接收數據並準備下一次數據的接收。touch
B類協議:co
與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)