29 Kernel Input subsystem multi-point reporting mechanism implementation

Source: Internet
Author: User

The capacitive screen is widely used, and the multi-touch mechanism also develops. Unfortunately, the 29 kernel does not support multi-point reporting, which will be supported by the kernel after 30.

We hereby record the porting process.

 

1. Modify include/Linux/input. h.

 Index: Include/Linux/input. h <br/> ============================================ =====================================< br/> --- include/Linux /input. H (Revision 1550) <br/> ++ include/Linux/input. H (working copy) <br/>-106,6 + 106,7 </P> <p> # define syn_report 0 <br/> # define syn_config 1 <br/> + # define syn_mt_report 2 </P> <p>/* <br/> * keys and buttons <br/>-644,6 + 645,18 <br/> # define abs_tool_width 0x1c <br/> # define abs_volume 0x20 <br/> # define abs_misc 0x28 <br/> + # define abs_mt_touch_major 0x30/* major axis of touching Ellipse */<br/> + # define abs_mt_touch_minor 0x31/* minor axis (omit if circular) */<br/> + # define abs_mt_width_major 0x32/* major axis of Approaching Ellipse */<br/> + # define abs_mt_width_minor 0x33/* minor axis (omit if circular) */<br/> + # define abs_mt_orientation 0x34/* ellipse orientation */<br/> + # define abs_mt_position_x 0x35/* center x ellipse position */<br /> + # define abs_mt_position_y 0x36/* center y ellipse position */<br/> + # define abs_mt_tool_type 0x37/* type of touching device */<br/> + # define abs_mt_blob_id 0x38/* group a set of packets as a blob */<br/> + # define abs_mt_tracking_id 0x39/* unique ID of initiated contact */< br/> + <br/> # define abs_max 0x3f <br/> # define abs_cnt (abs_max + 1) </P> <p >- 742,6 + 755,12 <br/> # define bus_atari 0x1b </P> <p>/* <br/> + * mt_tool types <br/> + */<br/> + # define mt_tool_finger 0 <br/> + # define mt_tool_pen 1 <br/> +/* <br/> * values describing the status of a force-feedback effect <br/> */<br/> # define ff_status_stopped 0x00 <br/> @-1310,6 + 1329,11 @@ <br/> input_event (Dev, ev_syn, syn_report, 0); <br/>}</P> <p> + static inline void input_mt_sync (struct input_dev * Dev) <br/> + {<br/> + input_event (Dev, ev_syn, syn_mt_report, 0 ); <br/>+}< br/> + <br/> void input_set_capability (struct input_dev * Dev, unsigned int type, unsigned int Code );

 

2. Modify Drivers/input. C.

Index: Drivers/input. c <br/> ======================================== ===================================< br/> --- Drivers/Input /input. C (Revision 1550) <br/> ++ Drivers/input. C (working copy) <br/>-29,6 + 29,25 </P> <p> # define input_devices 256 </P> <p> +/* <br/> + * ev_abs events which shoshould not be cached are listed here. <br/> + */<br/> + static unsigned int input_abs_bypass_init_data [] _ initd ATA = {<br/> + abs_mt_touch_major, <br/> + abs_mt_touch_minor, <br/> + region, <br/> + abs_mt_width_minor, <br/> + abs_mt_orientation, <br/> + abs_mt_position_x, <br/> + abs_mt_position_y, <br/> + abs_mt_tool_type, <br/> + abs_mt_blob_id, <br/> + abs_mt_tracking_id, <br/> + 0 <br/> + }; <br/> + static unsigned long input_abs_bypass [bits_to_longs (abs_cnt)]; <br/> + <br/> static list_head (input _ Dev_list); <br/> static list_head (input_handler_list); </P> <p >- 149,13 + 168,17 <br/> case syn_config: <br/> disposition = input_pass_to_all; <br/> break; <br/>-<br/> + <br/> case syn_report: <br/> If (! Dev-> sync) {<br/> Dev-> sync = 1; <br/> disposition = input_pass_to_handlers; <br/>}< br/> break; <br/> + case syn_mt_report: <br/> + Dev-> sync = 0; <br/> + disposition = input_pass_to_handlers; <br/> + break; <br/>}< br/> break; </P> <p>-185, 6 + 208,11 <br/> case ev_abs: <br/> If (is_event_supported (Code, Dev-> absbit, abs_max) {</P> <p> + If (test_bit (Code, input_abs_bypass )) {<br/> + disposition = input_pass_to_handlers; <br/> + break; <br/>+}< br/>+ <br/> value = input_defuzz_abs_event (value, <br/> Dev-> ABS [Code], Dev-> absfuzz [Code]); </P> <p >- 1630,10 + 1658,20 <br/>. open = input_open_file, <br/>}; </P> <p> + static void _ init input_init_abs_bypass (void) <br/> + {<br/> + const unsigned int * P; <br/> + for (P = input_abs_bypass_init_data; * P; P ++) <br/> + input_abs_bypass [bit_word (* P)] | = bit_mask (* P ); <br/>{}< br/> + <br/> static int _ init input_init (void) <br/>{< br/> int err; </P> <p> + input_init_abs_bypass (); <br/> + <br/> err = class_register (& input_class); <br/> If (ERR) {<br/> printk (kern_err "input: unable to register input_dev class/N ");

 

3. Input subsystem Initialization

Input_dev-> evbit [0] = bit (ev_syn) | bit (ev_key) | bit (ev_abs ); <br/> input_dev-> absbit [0] = <br/> bit_mask (abs_x) | <br/> bit_mask (abs_y) | <br/> bit_mask (abs_mt_touch_major) | <br/> bit_mask (latency) | <br/> bit_mask (abs_mt_position_x) | <br/> bit_mask (abs_mt_position_y) | <br/> bit_mask (abs_mt_tracking_id );

 

4. subsystem reporting

Input_report_key (ts-> input, abs_mt_tracking_id, touch_num); <br/> input_report_abs (ts-> input, abs_mt_position_x, mxt224_datablock.t_point [touch_num]. x); <br/> input_report_abs (ts-> input, abs_mt_position_y, mxt224_datablock.t_point [touch_num]. y); <br/> input_report_abs (ts-> input, abs_mt_touch_major, mxt224_datablock.t_point [touch_num]. amplnum); <br/> input_report_abs (ts-> input, abs_mt_width_major, mxt224_datablock.t_point [touch_num]. area); <br/> input_report_abs (ts-> input, abs_pressure, mxt224_datablock.t_gesture [touch_num]. value); <br/>/* input_report_key (ts-> input, btn_touch, 1); */</P> <p> input_mt_sync (ts-> input );

 

Note: Please indicate the source for reprinting.

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.