The Linux USB Input Subsystem, Part I
In the previous section, we saw that the device drivers basically sat between the hardware and the input core, translating hardware events, usually interrupts, into input events. To make use of those input events, we use handlers, which provide a user-space interface.
The input subsystem includes most of the handlers you'll likely need: a keyboard handler to provide a console, a mouse handler for applications like the X Window System, a joystick handler for games and also a touchscreen handler. There is also a general-purpose handler called the event handler, which basically provides input events to user space. This means you almost never need to write a handler in the kernel, because you can do the same thing with the event handler and equivalent code in user space. This API discussion is covered in the second part of this article.
I'd like to thank Greg Kroah-Hartman and Vojtech Pavlik for their assistance with this article.

Brad Hards is the technical director for Sigma Bravo, a small professional services company in Canberra. In addition to Linux, his technical focus includes aircraft system integration and certification, GPS and electronic warfare. Comments on this article can be sent to bradh@frogmouth.net.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- Web & UI Developer (JavaScript & j Query)
- UX Designer
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Nice article, thanks for the
2 hours 29 min ago - I once had a better way I
8 hours 15 min ago - Not only you I too assumed
8 hours 32 min ago - another very interesting
10 hours 25 min ago - Reply to comment | Linux Journal
12 hours 19 min ago - Reply to comment | Linux Journal
19 hours 13 min ago - Reply to comment | Linux Journal
19 hours 29 min ago - Favorite (and easily brute-forced) pw's
21 hours 20 min ago - Have you tried Boxen? It's a
1 day 3 hours ago - seo services in india
1 day 7 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Capture User Drawing
Hello all,
My name is sony, and now i want to learn about Linux USB Input Driver.
i read this article and wondering if you can help me to understand about my question.
here is the question:
I have pen tablet (genius), and i want to develop the new driver for it.
But before i do that, i use current driver (library) and try something with it.
I want to capture the position (x,y) when the user draw something on the pad using stylus.
What i get is the position of the pen touch, but i can't get the other position until the user release the stylus.
I was wondering if you can tell me how i capture the pen drawing (lets say signature) though the driver,
or the other hand, is how to get the whole position when the user try to draw something on the pad (not the pen over).
Hope you can help me...
Thank you.....
Need more clarity how the keystores moving from keyboard to cons
ur article is really good.i got some picture abt how keyboard is working ,can u please explain the same in to more clarity on how the keystrokes are moved from each subsystems.
ex : typing "S" in keyboard (h/w)----> how this data will move to "usbsubsystem" (usbstack - like (hid-input.o + hidcore.o=hid.o,usbkbd.o) -----> how usb data is translated/given to input subsystem---> from "input subsystem" to "console subsystem" -------> and from console to how it reaches "tty subsystem"
thanks a lot
Listing 3. aaaabbbb.c
Hi, Will you please guide me to run Listing 3. aaaabbbb.c
Also is it posiable to modify joystick pointer position by this examples
Many Thanks,
madni
LOOKING FOR PART II
Hi I am looking for part 2
where the event handler and equivalent code in user space. The API discussion is covered in the second part of this article.
Thanks
Slightly Different Name
It's called Using the Input Subsystem, Part II
Mitch Frazier is an Associate Editor for Linux Journal.