Touch Screen Based on mini2440 resistance (III): Linux input subsystem (inputsubsystem)

Source: Internet
Author: User

Reference: http://blog.chinaunix.net/uid-22174347-id-1786941.html

========================================================== ============================

Development Environment

Compilation System: fedora9

Compiler: arm-linux-4.4.3

Master chip: S3C2440

Development Board: mini2440

========================================================== ============================

I. Working Principle of resistive touch screen
Ii. S3C2440 resistive touch screen interface and internal ADC Structure
3. inputsubsystem)
Iv. mini2440 touch screen Driver Analysis

========================================================== ============================

3. inputsubsystem)

1. Linux input subsystem

In fact, most drivers are reprinted by others. The Linux input subsystem will be analyzed in detail later.

In Linux, the input subsystem is composed of the device driver layer of the input subsystem, the inputcore layer of the input subsystem, and the event handler layer of the input subsystem. The device driver layer provides read/write access to the hardware registers and converts the responses of the underlying hardware to user input access to standard input events, and then submits the requests to the event processing layer through the core layer; the core layer provides the device driver layer programming interface and the event processing layer programming interface; the event processing layer provides unified device access interfaces and event processing submitted by the driver layer for our user space applications. Therefore, the driver of the input device does not focus on the operations on the device file, but on the operations on the hardware registers and the input events submitted. Let's use graphs to describe the relationship between the three!

Input subsystem and driving relationship

2. Input subsystem device driver layer implementation principle

In Linux, the input device is described using the input_dev struct, which is defined in input. h. The device driver can be implemented by following the steps below.

(1) set the input device to support the data of the input subsystem in the driver module loading function;

(2) register the input device to the input subsystem;

(3) When an input operation occurs on the input device (for example, when the keyboard is pressed/lifted, the touch screen is touched/lifted/moved, and the mouse is moved/clicked/lifted ), submits events and corresponding key values/coordinates.

The event types of input devices in Linux are as follows (only common events are listed here. For more information, see Linux/input. h ):

Ev_syn 0x00 synchronization event ev_key 0x01 key event ev_rel 0x02 relative coordinates (for example, when the mouse moves, the reported offset relative to the last position) ev_abs 0x03 absolute coordinates (for example, the touch screen and operation lever report absolute coordinates) ev_msc 0x04 other ev_led 0x11 ledev_snd 0x12 Sound ev_rep 0x14 repeatev_ff 0x15 Force Feedback

The following functions are used to submit commonly used event types to the input subsystem:

Void input_report_key (struct input_dev * Dev, unsigned int code, int value); // void input_report_rel (struct input_dev * Dev, unsigned int code, int value ); // The Void input_report_abs (struct input_dev * Dev, unsigned int code, int value) function that submits relative coordinate events. // note the function that submits absolute coordinate events, after submitting an input device event, you must use the following method to synchronize the event to inform the input system that the device driver has issued a complete report: void input_sync (struct input_dev * Dev)

Related Article

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.