USB Component  Version 6.17.0
MDK Middleware for USB Device and Host Communication
Interface Descriptor

The Interface Descriptor (USB_INTERFACE_DESCRIPTOR) defines the collection of endpoints. This interface supports a group of pipes that are suitable for a particular task. Each configuration can have multiple interfaces. The interface can be selected dynamically by the USB Host. The Interface Descriptor can associate its collection of pipes with a device class, which in turn has an associated class device driver within the host operating system. Typically, the device class is a functional type such as a printer class or mass storage class.

An interface descriptor never includes Endpoint 0 in the numbering of endpoints. If an interface uses only Endpoint 0, then the field bNumEndpoints must be set to zero.

If no class type has been selected for the device, then none of the standard USB drivers is loaded, and the developer has to provide its own device driver.

Offset Field Type Size Value Description
0 bLength uint8_t 1 Number Size of this descriptor in bytes.
1 bDescriptorType uint8_t 1 Constant Interface Descriptor Type = 4.
2 bInterfaceNumber uint8_t 1 Number

The number of this interface.

Zero-based value identifying the index in the array of concurrent interfaces supported by this configuration.

3 bAlternateSetting uint8_t 1 Number Value used to select an alternate setting for the interface identified in the prior field. Allows an interface to change the settings on the fly.
4 bNumEndpoints uint8_t 1 Number

Number of endpoints used by this interface (excluding endpoint zero).

  • If this value is zero, this interface uses the Default Control Pipe only.
5 bInterfaceClass uint8_t 1 Class

Class code (assigned by the USB-IF).

  • A value of zero is reserved for future standardization.
  • If this field is set to FFh, the interface class is vendor specific.
  • All other values are reserved for assignment by the USB-IF.
6 bInterfaceSubClass uint8_t 1 SubClass

Subclass code (assigned by the USB-IF).

If bInterfaceClass

  • is reset to zero, this field must also be reset to zero.
  • is not set to FFh, all values are reserved for assignment by the USB-IF.
7 bInterfaceProtocol uint8_t 1 Protocol

Protocol code (assigned by the USB).

If an interface supports class-specific requests, this code identifies the protocols that the device uses as defined in the device class.
If this field

  • is reset to zero, the device does not use a class-specific protocol on this interface.
  • is set to FFh, the device uses a vendor specific protocol for this interface.
8 iInterface uint8_t 1 Index Index of string descriptor describing this interface.

For example, two devices with different interfaces are needed.

The first interface, Interface0, has the field bInterfaceNumber set to 0. The next interface, Interface1, has the field bInterfaceNumber set to 1 and the field bAlternativeSetting also set to 0 (default). It is possible to define an alternative setting for this device, by leaving the field bInterfaceNumber set to 1 and with the field bAlternativeSetting set to 1 instead of 0.

The first two interface descriptors with bAlternativeSettings equal to 0 are used. However, the host can send a SetInterface() request to enable the alternative setting.

Alternative Interface