Adroid touch screen device

Source: Internet
Author: User
Document directory
  • 1.1 multi-point touch
  • 1.2 single touch
  • 1.3 enter the device configuration file
1. Touch screen device category 1.1 multi-point touch

The following two conditions are met:

1) input the device driver report.ABS_MT_POSITION_XAndAbs_mt_position_y exists

2) The input device does not have any handle buttons

1.2 single touch

The following two conditions are met:

1) The input device is not classified as a multi-touch device.

2) input the device report that the absolute axes abs_x and abs_y exist, and the btn_touch key code exists.

1.3 enter the device configuration file

All built-in Touch devices should have the configuration file of the input device (. IDC, input device configuration files ). if the input device configuration file does not exist, the system selects a general touch device configuration as the default configuration. These default configurations are not specifically designed for built-in Touch devices and may cause abnormal operations.

After the input device configuration (IDC) is loaded, the system divides the input device into touch screen, touch pad, or pointer device ).

1) Touch Screen: You can use it to directly operate objects on the screen.

2) touchpad: it provides absolute positioning information to applications in the touch area.

3) pointer device: it is used to indirectly manipulate objects on the screen through the cursor. Fingers are multi-point touch pointer gestures. Other tools, such as iron pens, are interpreted as using absolute positions.

 

The classification rules for the above three types of devices are as follows:

1) if the touch. devicetype attribute is set in. IDC, the device type is set to the device type specified by it (for example, touchscreen)

2) If the input device reports an input_prop_direct INPUT attribute through eviocgprop ioctl, the device type is set to a touch screen.

3) if the input device reports an input_prop_pointer INPUT attribute through eviocgprop ioctl, the device type is set as a pointer device.

4) if the input device reports a relative axis of rel_x and rel_y, the device type is set to touchpad.

5) if the above conditions are not met, the device type is set as a pointer device.

2. Button

The button is an optional control, and the application uses it to execute this function. The touch button function on the device is similar to the mouse button, mainly used by the pointer to touch the device or iron pen.

The supported buttons are as follows:

Btn_left: mapped to motionevent. button_primary.
Btn_right: mapped to motionevent. button_secondary.
Btn_middle: mapped to: motionevent. button_middle.
Btn_back and btn_side: mapped to motionevent. button_back. Press this button to generate a key: keyevent. keycode_back.
Btn_forward and btn_extra: ing to motionevent. button_forward. Press this button to generate a key: keyevent. keycode_forward.
Btn_stylus: mapped to: motionevent. button_secondary.
Btn_stylus2: mapped to: motionevent. button_tertiary.

3. Tools and tool types

A tool is a finger, iron pen, or other device used to interact with a touch device. Some Touch devices can differentiate different types of touch tools. Android supports the following Touch Tool types:

  • BTN_TOOL_FINGERAndMT_TOOL_FINGER: MappedMotionEvent.TOOL_TYPE_FINGER.

  • BTN_TOOL_PENAndMT_TOOL_PEN: MappedMotionEvent.TOOL_TYPE_STYLUS.

  • BTN_TOOL_RUBBER: MappedMotionEvent.TOOL_TYPE_ERASER.

  • BTN_TOOL_BRUSH: MappedMotionEvent.TOOL_TYPE_STYLUS.

  • BTN_TOOL_PENCIL: MappedMotionEvent.TOOL_TYPE_STYLUS.

  • BTN_TOOL_AIRBRUSH: MappedMotionEvent.TOOL_TYPE_STYLUS.

  • BTN_TOOL_MOUSE: MappedMotionEvent.TOOL_TYPE_MOUSE.

  • BTN_TOOL_LENS: MappedMotionEvent.TOOL_TYPE_MOUSE.

  • BTN_TOOL_DOUBLETAP,BTN_TOOL_TRIPLETAP, AndBTN_TOOL_QUADTAP: MappedMotionEvent.TOOL_TYPE_FINGER.

    4. Hover vs. Touch Tool

    The tool is in contact with the touch device or hovering within a certain range of the touch device. Not all touch devices can recognize that the Touch Tool hovers over the touch device. For example, a RF-based pen digital meter can detect a tool that hovers within a certain range.

    The inputreader module is used to differentiate which hovering tools are used in touch tools. Similarly, touching tools and hovering tools are reported to applications in different ways.

    The Touch Tool reports to applications through touch events, such:MotionEvent.ACTION_DOWN,MotionEvent.ACTION_MOVE,MotionEvent.ACTION_DOWN,MotionEvent.ACTION_POINTER_DOWNAndMotionEvent.ACTION_POINTER_UP。

    Hovering tools report to applications through general motion events (generic motion events), such:MotionEvent.ACTION_HOVER_ENTER,MotionEvent.ACTION_HOVER_MOVEAndMotionEvent.ACTION_HOVER_EXIT.   

    5. Touch Device Driver requirements

    1) The touch device driver only needs to register the axis, the key value corresponding to the axis, and the buttons that are actually supported. Registering too many axes or key values may confuse the device classification algorithm or cause the system to fail to correctly detect the device's capabilities.

    For example, if the device driver reports the btn_touch key value, the android system will think that btn_touch is always used to indicate whether the Touch Tool is actually touching the touch screen or hovering above it.

    2) Single-Touch devices support the following Linux input events:

    • Abs_x: (required): X coordinate of the reporting tool
    • Abs_y: (required): Y coordinate of the reporting tool
    • Abs_pressure: (optional): report the pressure at the top of the touch tool or the signal strength of the touch contact.
    • Abs_tool_width: (optional): the width of the exposed area, or the width of the tool.
    • Abs_distance: (optional): report the distance from the touch device surface to the tool
    • Abs_tilt_x: (optional): tilt of the reporting tool along the X axis of the touch device surface
    • Abs_tilt_y: (optional): tilt of the reporting tool along the Y axis of the touch device surface.
    • Btn_touch: (required): indicates whether the tool is in touch with the device.
    • Btn_left, btn_right, btn_middle, btn_back, btn_side, btn_forward, btn_extra, btn_stylus, btn_stylus2: (optional): Report button status.
    • Btn_tool_finger, btn_tool_pen, pen, btn_tool_brush, btn_tool_penpencil, btn_tool_airbrush, btn_tool_mouse, cursor, btn_tool_quadtap: (optional) report tool type.

    3) multi-touch devices support the following Linux input events:

    • Abs_mt_position_x: (required): X coordinate of the reporting tool
    • Abs_mt_position_y: (required): X coordinate of the reporting tool
    • Abs_mt_pressure: (optional): report the stress or touch signal strength at the top of the Touch Tool.
    • Abs_mt_touch_major: (optional): report contact area or contact surface long axis
    • Abs_mt_touch_minor: (optional) short axis of the report contact surface. If abs_mt_touch_major reports the contact area, this parameter should not be used.
    • Abs_mt_width_major: (optional) area of the contact tool itself, or the long axis of the contact tool itself. If the contact Tool size is unknown, do not use this parameter.
    • Abs_mt_width_minor: (optional): report the short axis of the contact tool itself. If abs_mt_width_major reports the area or the contact Tool size is unknown, this parameter should not be used.
    • Abs_mt_orientation: (optional) Direction of the reporting tool.
    • Abs_mt_distance: (optional): report the distance from the touch device surface to the tool.
    • Abs_mt_tool_type: (optional) report tool type: mt_tool_finger or mt_tool_pen.
    • Abs_mt_tracking_id: (optional): trace of the report tool.
    • Abs_mt_slot: (optional): the slot ID of the reporting tool. When Linux Multi-Point Protocol B is used, refer to its documentation for more information.
    • Btn_touch: (required)
      : Indicates whether the tool is in touch with the device.
    • Btn_left, btn_right, btn_middle, btn_back, btn_side, btn_forward, btn_extra, btn_stylus, btn_stylus2: (optional): Report button status
    • Btn_tool_finger, btn_tool_pen, btn_tool_rubber, btn_tool_brush, crop, btn_tool_airbrush, btn_tool_mouse, crop, btn_tool_quadtap: (optional) report tool type

    4) if the single-point touch and multi-point touch axes are defined, only the Multi-Point Protocol axes are used, and the single-point touch axes are ignored.

    5)ABS_X,ABS_Y,
    ABS_MT_POSITION_X
    AndABS_MT_POSITION_YThe minimum and maximum values of the Axis define the boundary of the active area in units (such as pixels) of the device surface. For touch screens, the active area describes the area where the touch device truly overwrites the display area.

    6) in android4.0, touch screen drivers must be modified to be compatible with Linux input protocol specifications.

    The following changes may be required:

    1) when a tool becomes inactive (for example, raising your finger), it should not appear in the subsequent multi-touch sync report; when all the tools are not active (for example, all the fingers are raised), the driver should send an empty sync report package, for example, syn_mt_report followed by a syn_report.

    Previous Android versions expected to report an up event (by sending a pressure value of 0 ). The old operation method is not compatible with the Linux input protocol specification, so it is no longer used.

    2) The physical pressure or signal strength information should be reported using abs_mt_pressure.

    In earlier Android versions, pressure information is obtained from abs_mt_touch_major. The old operation method is not compatible with the Linux input protocol specification, so it is no longer used.

    3) The touch size information is reported through abs_mt_touch_major.

    In earlier Android versions, the touch size information is obtained from abs_mt_tool_major. The old operation method is not compatible with the Linux input protocol specification, so it is no longer used.

    Android customization is no longer required for touch device drivers. With the standard Linux input protocol, Android supports a large number of Touch devices without modifying the driver.

     

     

    Reference: http://source.android.com/tech/input/touch-devices.html

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • 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.