Linux driver touch screen (3)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.