The development of the Linux USB subsystem started in 1997 and in the meantime it was redesigned many times. This implied various changes of its internal structure and its API too. So it is even hard for experienced device driver developers to keep up to date with all ongoing discussions and current changes.

This document should give detailed information about the current state of the USB subsystem and its API for USB device drivers. The first section will deal with the basics of USB devices. You will learn about different types of devices and their properties. Going into detail you will see how USB devices communicate on the bus. The second section gives an overview of the Linux USB subsystem [2] and the device driver framework. Then the API and its data structures will be explained step by step. The last section of this document contains a reference of all API calls and their return codes.

The Universal Serial Bus
In 1994 an alliance of four industrial partners (Compaq, Intel, Microsoft and NEC) started to specify the Universal Serial Bus (USB). The bus was originally designed with these intentions:
- Connection of the PC to the telephone
- Ease-of-use
- Port expansion
The specification (version 1.0) was first released in january 1996 and the latest official version 1.1 was released in september 1998 [4]. The document is still under development and a version 2.0 was announced in 1999. More information and all specification papers can be found in [1]. The USB is strictly hierarchical and it is controlled by one host. The host uses a master / slave protocol to communicate with attached USB devices. This means that every kind of communication is initiated by the host and devices cannot establish any direct connection to other devices. This seems to be a drawback in comparison to other bus architectures but it is not because the USB was designed as a compromise of costs and performance. The master / slave protocol solves implicitly problems like collision avoidance or distributed bus arbitration. The current implementation of the USB allows 127 devices to be connected at the same time and the communication bandwidth is limited to 12Mbit/s.

Download pdf Programming Guide for Linux USB Device Drivers