Last month I gave an overview of the USB kernel subsystem, but I didn’t have the space needed to show real code at work. This month we’ll fill the gap by looking at sample drivers implementing input devices in the USB framework. The code being introduced has been developed and tested on version 2.3.99-pre6 of the Linux kernel, running on an Intel x86 machine.
Figure One: An overview of the data flow related to the idiom sample module.
Last month I gave an overview of the USB kernel subsystem, but I didn’t have the space needed to show real code at work. This month we’ll fill the gap by looking at sample drivers implementing input devices in the USB framework. The code being introduced has been developed and tested on version 2.3.99-pre6 of the Linux kernel, running on an Intel x86 machine.
The sample module introduced here is called idiom (Input Device for Intercepting Output of Mice), and its source code is available for download from ftp://ftp.linux.it/pub/People/rubini/idiom.tar.gz. The sample module registers itself with the USB kernel subsystem as a mouse driver and with the input management subsystem as a keyboard driver. idiom translates mouse movement events into keyboard input events: it reports arrow events to the input system according to how the physical mouse is moved.
Since the module registers itself as a USB device, you can’t test its workings if you don’t have a USB mouse to generate events. To partially fill the gap, idiom offers an additional entry point, /dev/idiom, where you can write text strings that will be converted to USB keyboard events.
Overview of the Idiom Module
…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: