Input subsystem of Linux driver subsystem (5)
5. Summary
5.1 Event Reporting Process Analysis
L General reporting process: Device Driver layer-> core layer-> event processing layer-> Application Layer
L specific called functions (taking evdev as an example): input_event ()-> input_handle_event ()-> input_pass_event ()-> handle-> Handler-> event (handle, type, code, value)-> evdev_event ()-> evdev_pass_event (), and then assign the value to the client (struct evdev_client) through client-> buffer [client-> head ++] = * event)
It is strange that this is not still in the kernel space and is not passed to the application space at all. Don't forget that the event driver layer also implements a file_operations. Let's take a look at the evdev_read function:
Static ssize_t evdev_read (struct file * file, char _ User * buffer,
Size_t count, loff_t * PPOs)
{
Struct evdev_client * client = file-> private_data;
Struct evdev * evdev = client-> evdev;
Struct input_eventevent;
While (retval + input_event_size () <= count &&
Evdev_fetch_next_event (client, & event )){
If (input_event_to_user (buffer + retval, & event ))
Return-efault;
Retval + = input_event_size ();
}
}
You can see it. Use input_event_to_user ()-> copy_to_user () to transfer the information to the user space.
5.2 relationship between input_dev, input_handler, and input_handle
L relationship between input_dev, input_handler, and input_handle: