The input subsystem is the middle layer driven by all I/O devices. How can I provide interfaces for various input devices in the lower layer and a unified interface for the upper layer?
According to the kernel code, there are two linked lists in the input subsystem: input_dev_list and input_handler_list. When registering an input_dev, it is mounted to input_dev_list and matched to input_handler_list, when registering an input_handler, it will be mounted to input_handler_list and matched to input_dev on input_dev_list. When the matching succeeds, the connect function of the handler will be called, this function generally creates and registers an input_handle, which contains information related to input_dev and input_handler, in this way, when the lower layer reports an event to the input subsystem, you can use input_handle to find the corresponding input_handler and call the relevant functions to further provide services for the previous time.
For example, the relationship between input_dev, input_handler, input_handle, and 3 is represented. One type of handler can be associated with multiple hardware devices. One hardware device can be associated with multiple handler devices. For example, a touch screen device can be used as an event device, a mouse device, or a touch device. Therefore, a device must be connected to multiple platform drivers. A platform driver serves not only one device, but also an upper-layer driver for a, B, and C3 Touch devices. Therefore, one-to-multiple connection is required.