Input subsystem of Linux driver subsystem (5)

Source: Internet
Author: User

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:

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.