USB uses a set of data called "descriptors" to allow devices to be properly recognized by the host. Each USB 2.0 device has the following 7 descriptors (increased from 5 in USB 1.x).

 

Kind of Descriptor Contents Connection of each Descriptor
Device
Descriptor

Specifies information such as the supported USB version, the Device Class, Device SubClass, Protocol, and maximum packet size for Endpoint 0.

  • Vender ID, Product ID, Device version, number of possible configurations
  • Index of String Descriptor
Exactly 1 for each device.
Configuration
Descriptor

Specifies information such as the number of interfaces, and the value for selecting the configuration.

  • Device attributes (i.e. how the device is powered)
  • Consumption Electricity
  • Index of String Descriptor
1 or more per device. Each Configuration Descriptor has 1 or more Interface Descriptor.
Interface
Descriptor

Specifies information such as the value for selecting the interface.

  • Number of alternative settings.
  • Number of endpoints.
  • Interface Class, Interface SubClass, Interface Protocol, String Descriptor Index
 
Endpoint
Descriptor

Specifies information such as the value for selecting the endpoint.

  • Transfer type (direction of transfer)
  • Maximum packet size available for transfer
  • Interval for transfers
Exists independently for each Interface Descriptor. Depending on the interface, there may be an Interface Descriptor without Endpoint Descriptors, since Endpoint 0 is defined by a Device Descriptor and not an Endpoint Descriptor.
String
Descriptor
Contains a text string.  
Device_Qualifier
Descriptor
Identical to a Device Descriptor, with the exception of the Vendor ID, Product ID, and Device version. Used as the Device Descriptor for when the device is to operate at a speed mode that is currently not selected. Exactly 1 for each high-Speed capable device.
Other_Speed_
Configuration
Descriptor
Has the same structure as a Configuration Descriptor, and has Interface and Endpoint descriptors. Used as the Configuration Descriptor for when the device is to operate at a speed mode that is currently not selected. 1 or more for each high-Speed capable device.

 

Endpoint Descriptors describe buffers that exist within an USB Interface. Every endpoint, with the exception of Endpoint 0, has an Endpoint Descriptor. An "Interface" is a unit that is used to group and manage multiple endpoints.
By grouping endpoints as an Interface, it is possible to design devices that have multiple functions. On an USB device, Class and Subclass can be defined by both Device and Interface descriptors. Take a set of speakers for example. You will need Endpoint 0 (Control) for controlling the speakers, and Endpoint 1 (Isochronous) for receiving audio data. You can also have an optional Endpoint 2 (Interrupt) for notifying the PC when the volume is changed on the speakers.

Class and Subclass

Example of Speaker

 

Suppose that there is no concept of an "Interface." A device with Endpoint 0/1 and a device with Endpoint 0/1/2 will both be defined to be in the Audio Class by their Device Descriptor, but will each have a different device driver on a PC. While this may not be an issue in developing the driver software, it is not the most efficient approach either. It will be much easier to reuse the driver components if the driver can be developed independently for Endpoint 0/1 and Endpoint 2. In this particular example, the optional Endpoint 2 can actually be categorized into the HID Class, along with mice and keyboards. If endpoints can be grouped as Interfaces, and drivers can be associated to the Interfaces, then it will be possible to develop drivers independently for each Interface. This is why Class, SubClass, and Protocol can be defined for an Interface. Furthermore, Interfaces introduce a concept of "Alternative Setting." This is particularly effective for an Isochronous Endpoint. In terms of audio data, the amount of data transmitted via the bus will vary greatly depending on the number of PCM bits and on whether the track is stereo or mono.

  • 1byte(PCM) × 45(44.1kHz) × 1(Monaural) = 45 byte/ms
  • 1byte(PCM) × 45(44.1kHz) × 2(Stereo) = 90 byte/ms
  • 2byte(PCM) × 45(44.1kHz) × 1(Monaural) = 90 byte/ms
  • 2byte(PCM) × 45(44.1kHz) × 2(Stereo) = 180 byte/ms

 

In order to secure sufficient bandwidth to establish a communication between the client software and the function controller, you may need to adjust the maximum packet size according to the amount of data transferred. "Alternative Setting" can be used when it is possible to configure the maximum packet size from the PC.
With the exception of Endpoint 0, endpoints generally cannot be shared between multiple Interfaces (we'll ignore the "Shared Endpoint" concept for now). The combination of an Interface and an Endpoint can only be changed by defining the combination as a separate Configuration. This is why each device can hold multiple Configuration Descriptors. The host reads the Device Descriptor using the GetDescriptor Device command, defined by the USB specification. The applicable driver is searched for by comparing the obtained Vendor ID, Product ID, and/or Class and Subclass with the driver list in an "Inf" file, or by comparing the Class and Subclass described by the Interface Descriptor with the driver list in an "Inf" file.