Note: This series turns from: http://www.ourunix.org/post/290.html
Introduction to the input subsystem
Input devices (such as keystrokes, keyboards, touchscreens, mice, buzzers, etc.) is a typical character device, its general working mechanism is the bottom of the button, touch and other actions occur when an interrupt (or drive through Timer timer query), and then the CPU through the SPI,I2C or external memory bus read the key value, Coordinates such as data, put a buffer, character device driver manages the buffer, and the drive of the read () interface allows the user to read key values, coordinates and other data.
In Linux, the input subsystem consists of the input subsystem device driver layer, input subsystem core layer (input core), and the input Subsystem event processing layer (Handler). wherein the device driver layer provides read and write access to the hardware registers and converts the response of the underlying hardware to the user input to the standard input events, and then submits to the event processing layer through the core layer, while the core layer provides the programming interface of the device driver layer, and the programming interface of the event processing layer is provided. , and the event processing layer provides the interface of the unified access device and the event processing that the driver layer submits for our user-space applications. So this allows us to input the driver part of the device is not concerned with the operation of the device files, but to care about the operation of each hardware register and the input events submitted.
In Linux, the input subsystem exists as a module, upward, provides interface functions for the user layer, and downward, providing a uniform interface function for the driver layer program. Its construction is very flexible, just call some simple functions, you can put the function of an input device to the application. This enables the input device's events to be sent to the user-tier application through the input subsystem, which can also be used by the user-tier application to notify the driver of a function through the input subsystem.
Input subsystem structure diagram
Linux input Subsystem (6)-input subsystem introduction and Structure diagram