x
Loading
 Loading
Hello, Guest | Login | Register

Writing Modules for USB

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.

Gearheads Figure 1
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:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace