Each device has at least one configuration that defines the device’s features and abilities. Multiple configurations are allowed but rare. The configuration descriptor contains information about the device’s use of power and the number of interfaces supported. Table 3-2 shows the fields in the configuration descriptor. Here are more details about the fields and how they’re used in a mass-storage device:
bLength. The length in bytes of the descriptor. Always 09h.
bDescriptorType. The constant CONFIGURATION (02h).
wTotalLength. The number of bytes in the configuration descriptor and all of its subordinate descriptors. The subordinate descriptors include interface and endpoint descriptors but do not include string descriptors.
bNumInterfaces. The number of interfaces in the configuration. The minimum is 1. A device with multiple interfaces can perform multiple functions, such as mass storage and human-interface device.
bConfigurationValue. Identifies the configuration in Get Configuration and Set Configuration requests. Set to 01h for the first (or only) configuration.
Table 3-2: The configuration descriptor has information about the device’s power requirements.
iConfiguration. Index to a string descriptor that contains a string describing the configuration. This value is zero if there is no configuration string descriptor.
bmAttributes. Bit 6 = 1 if the device is self-powered or zero if bus-powered. Bit 5 = 1 if the device supports the remote wakeup feature, which enables a suspended USB device to tell its host that the device wants to communicate. A USB device must enter the Suspend state if there has been no bus activity, including Start-of_Frame markers, for 3 milliseconds. If a suspended device requires action from the host, a device with remote wakeup enabled can request the host to resume communications. Mass-storage devices typically don’t support remote wakeup. Bits 0..4 must equal 0. Bit 7 must equal 1.
bMaxPower. Specifies how much bus current a device requires. The bMax- Power value equals one half the number of milliamperes requested. If a device requires 200 milliamperes, bMaxPower = 100. The maximum current a device can request is 500 milliamperes. If the requested current isn’t available, the host can refuse to configure the device. Some battery-powered hosts and all bus-powered hubs supply only 100 milliamperes per port. To enable a device to operate entirely from bus power when attached to these hosts and hubs, bMaxPower must equal 32h or less.
interface. This value is zero if there is no interface string descriptor.