Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Generating and reporting an input event

Device allocation and registration are essential, but they are not the main goals of an input device driver, which is designed to report events to the input core. Depending on the type of event your device supports, the kernel provides the appropriate APIs to report them to the core.

Given an EV_XXX capable device, the corresponding report function would be input_report_xxx(). The following table shows mappings between the most important event types and their report functions:

Event type

Report function

Code example

EV_KEY

input_report_key()

input_report_key(poll_dev->input, BTN_0, gpiod_get_value(ms-> reset_btn_desc) & 1);

EV_REL

input_report_rel()

input_report_rel(nunchuk->input, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content