The USB 1.x is a 12 Mb/s serial bus with 1.5 Mb/s for low speed devices. USB 2.x handles 480 Mb/s. Each USB has a host controller that is the master of the bus; all other devices on the bus only speak when spoken to.
There can be up to 127 devices (apart from the host controller) on a bus, each with its own address. The addresses are assigned dynamically by the host when each device is attached to the bus.
Within each device there can be up to 16 endpoints. Each endpoint is individually addressed and the addresses are static. Each of these endpoints will communicate in one of four different modes: control, isochronous, bulk, or interrupt. A device always has at least one endpoint. This endpoint has address 0 and is a control endpoint and is used to give commands to and extract basic data, such as descriptors, from the device. Each endpoint, except the control endpoint, is unidirectional.
The endpoints in a device are grouped into interfaces. An interface is a logical unit within a device; e.g., a compound device with both a keyboard and a trackball would present one interface for each. An interface can sometimes be set into different modes, called alternate settings, which affects how it operates. Different alternate settings can have different endpoints within it.
A device may operate in different configurations. Depending on the configuration the device may present different sets of endpoints and interfaces.
Each device located on a hub has several
config(1) locators:
port
this is the number of the port on closest upstream hub.
configuration
this is the configuration the device must be in for this driver to attach. This locator does not set the configuration; it is iterated by the bus enumeration.
interface
this is the interface number within a device that an interface driver attaches to.
vendor
this is the 16 bit vendor id of the device.
product
this is the 16 bit product id of the device.
release
this is the 16 bit release (revision) number of the device.
The first locator can be used to pin down a particular device according to its physical position in the device tree. The last three locators can be used to pin down a particular device according to what device it actually is.
The bus enumeration of the USB bus proceeds in several steps:
1.
Any device specific driver can attach to the device.
2.
If none is found, any device class specific driver can attach.
3.
If none is found, all configurations are iterated over. For each configuration all the interface are iterated over and interface drivers can attach. If any interface driver attached in a certain configuration the iteration over configurations is stopped.
4.
If still no drivers have been found, the generic USB driver can attach.