http://blog.csdn.net/zuosifengli/article/details/7398661
Multi-Touch protocol in Android:
Reference: Http://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt
1, two kinds of multi-touch protocol:
1) Class A: Dealing with unrelated contacts: for sending raw data directly;
Class B: Handle the contact of the tracking recognition class: Sends an associated independent contact update through the event slot.
2. Use of touch protocol:
Class A agreements:
A-class protocol calls Input_mt_sync () to declare the end of the data after each contact packet is sent, and Input_mt_sync () emits a syn_mt_report
Prompts the receiver to receive data and prepares the next data receipt.
B-Type protocol:
Unlike a-class protocol, Class B, when using Input_mt_slot (), takes a slot parameter, generating a Abs_mt_slot event at the beginning of each packet, prompting the receiver to update the data.
Finally A, Class B protocol will call Input_sync ();
The difference between Class A and Class B protocol is that the B-class protocol requires the use of the abs_mt_tracking_id------can be obtained from the hardware, or from the raw data, through the Class B protocol slot protocol.
3, Class B agreement: abs_mt_tracking_id represents a contact;-1 represents a slot that is not used;
Use the reference example:
Release event:
Input_mt_slot (Data->input_dev, i);
Input_mt_report_slot_state (Data->input_dev, Mt_tool_finger, false); ---------------Release
Click events:
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)
Add: Tags for different events: Memo.
Abs_mt_touch_major
The length of the major axis of the the contact. The length should be given insurface units. If the surface has a X times Y resolution, the largestpossible value of Abs_mt_touch_major is sqrt (x^2 + y^2), the Diagon Al [4].
Abs_mt_touch_minor
The length, in surface units, of the minor axis of the. If Thecontact is circular, the this event can be omitted [4].
Abs_mt_width_major
The length, in surface units, of the major axis of the the Approachingtool. This should is understood as the size of the tool itself. Theorientation of the contact and the approaching tool is assumed to be thesame [4].
Abs_mt_width_minor
The length, in surface units, of the minor axis of the The Approachingtool. Omit if circular [4]. The above four values can is 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].
Abs_mt_pressure
The pressure, in arbitrary units, the May is used insteadof TOUCH and WIDTH for pressure-based devices or any device with a spatialsignal intensity distribution .
Abs_mt_distance
The distance, on 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.
Abs_mt_orientation
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 is returned for a finger aligned along the yaxis of the surface, a neg Ative value when finger was turned to the left, anda positive value when finger turned to the right. When completely aligned withthe X axis, the range Max should is returned. Orientation can omittedif the touching object is circular, or if the information are not availablein the kernel driver. Partial Orientation support is possible if the Devicecan distinguish between the "axis, but not" (uniquely) any values I Nbetween. In such cases, the range of abs_mt_orientation should is [0, 1][4].
Abs_mt_position_x
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.
Abs_mt_tool_type
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 is omitted. The protocol currently supports Mt_tool_finger Andmt_tool_pen [2]. For type B devices, the This event was handled by input core;drivers should instead use Input_mt_report_slot_state ().
abs_mt_blob_id
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 was a low-level anonymous grouping for type a devices, andshould not being confused with the high-level Trackingid [5]. Most type adevices does not have a BLOB capability, so drivers can safely omit this event.
abs_mt_tracking_id
The tracking_id identifies an initiated contact throughout it life cycle[5]. The value range of the tracking_id should is large enough to ensureunique identification of a contact maintained over an E xtended period oftime. For type B devices, this event was handled by input core; Driversshould instead use Input_mt_report_slot_state ().
Multi-Touch protocol in Android