3. multi-touch
3.1 Overview
Multi-point touch is nothing special. It is to bind multiple single points and combine them into a set of coordinate values. Then, the upper-layer application parses the gesture, and then uses the two fingers we usually see to scale the image. Multi-touch support from Linux-2.6.30.
3.2 single touch and multi-touch
L single-point touch and multi-point touch are both based on the input subsystem, so the implementation difference in software is not great.
L parameter settings
Single touch:
Input_dev-> evbit [0] = bit_mask (ev_key) | bit_mask (ev_abs );
Input_dev-> keybit [bit_word (btn_touch)] = bit_mask (btn_touch );
Input_set_abs_params (input_dev, abs_x, 0, xmax, 0, 0 );
Input_set_abs_params (input_dev, abs_y, 0, Ymax, 0, 0 );
Multi-touch:
_ Set_bit (ev_abs, input_dev-> evbit );
/* Fingerposition */
Input_set_abs_params (input_dev, abs_mt_position_x, xmin, xmax, 0, 0 );
Input_set_abs_params (input_dev, abs_mt_position_y, ymin, Ymax, 0, 0 );
Input_set_abs_params (input, abs_mt_touch_major, 0, touch_max, 0, 0 );
Input_set_abs_params (input, abs_mt_width_major, 0, width_max, 0, 0 );
..... // Other Event code may be set.
L data reporting method
Single touch:
Input_report_abs (input_dev, abs_x, XP );
Input_report_abs (input_dev, abs_y, YP );
Input_report_key (input_dev, btn_touch, 1 );
Input_sync (input_dev );
Multi-touch:
/* Report the first vertex */
Input_report_abs (input_dev, abs_mt_position_x, xp1 );
Input_report_abs (input_dev, abs_mt_position _ y, yp1)
Input_report_abs (priv-> input, abs_mt_touch_major, value );
The value of value must be changed, and the touch function cannot be implemented.
Input_report_abs (priv-> input, abs_mt_width_major, 0 );
Input_mt_sync (input_dev );
/* Report the second vertex */
Input_report_abs (input_dev, abs_mt_position_x, xp2 );
Input_report_abs (input_dev, abs_mt_position _ y, yp2)
Input_report_abs (priv-> input, abs_mt_touch_major, value);/* abs_mt_touch_major: Contact Area event */
The value of value must be changed, and the touch function cannot be implemented.
Input_report_abs (priv-> input, abs_mt_width_major, 0);/* abs_mt_width_major: Area event of the Touch Tool (such as the area of the touch screen when the fingers touch the touch screen */
Input_mt_sync (input_dev );
Input_sync (input_dev );
You can also simplify the above Code:
For (I = 0; I <2; I ++ ){
Input_report_abs (priv-> input, abs_mt_position_x, ypos [I]);
Input_report_abs (priv-> input, abs_mt_position_y, xpos [I]);
Input_report_abs (priv-> input, abs_mt_touch_major, value [I]);
Input_report_abs (priv-> input, abs_mt_width_major, 0 );
Input_mt_sync (priv-> input );
}
Input_sync (priv-> input );
Currently, there are not many multi-touch drivers in the kernel. For more information, see bcm5974.c. This driver is a multi-touch Driver Based on the MTP Class A protocol. The last time I saw a MTP-based multi-point touch driver egalax_ts in the mail list, I still pushed it to the kernel.