/**
* @brief USB configuration descriptor.
*/
typedef struct __attribute__ ((packed))
{
uint8_t bLength ; /**< Size of this descriptor in bytes. */
uint8_t bDescriptorType ; /**< CONFIGURATION Descriptor Type. */
uint16_t wTotalLength ; /**< Total length of data returned for this configuration. Includes the combined length of all descriptors (configuration, interface, endpoint, and class- or vendor-specific) returned for this configuration. */
uint8_t bNumInterfaces ; /**< Number of interfaces supported by this configuration. */
uint8_t bConfigurationValue ; /**< Value to use as an argument to the SetConfiguration() request to select this configuration. */
uint8_t iConfiguration ; /**< Index of string descriptor describing this configuration. */
uint8_t bmAttributes ; /**< Configuration characteristics \n D7: Reserved (set to one)\n D6: Self-powered \n D5: Remote Wakeup \n D4...0: Reserved (reset to zero) \n D7 is reserved and must be set to one for historical reasons. \n A device configuration that uses power from the bus and a local source reports a non-zero value in bMaxPower to indicate the amount of bus power required and sets D6. The actual power source at runtime may be determined using the GetStatus(DEVICE) request (see USB 2.0 spec Section 9.4.5). \n If a device configuration supports remote wakeup, D5 is set to one. */
uint8_t bMaxPower ; /**< Maximum power consumption of the USB device from the bus in this specific configuration when the device is fully operational. Expressed in 2 mA units (i.e., 50 = 100 mA). */
}usb_desc_configuration_t;
field | description |
---|---|
bLength | 配置描述符的长度。标准的 USB 配置描述符的长度为 9 字节。 |
bDescriptorType | 描述符的类型。配置描述符的类型编码为 0x02。 |
wTotalLength | 2 个字节,表示整个配置描述符集合的总长度,包括配置描述符,接口描述符,类特殊描述符(如果有)和端点描述符,注意低字节在前。 |
bNumInterfaces | 表示该配置所支持的接口数量。通常功能单一的设备只具有一个接口,而复合设备则具有多个接口。 |
bConfigurationValue | 表示该配置的值。通常一个 USB 设备可以支持多个配置,bConfiguration 就是每个配置的标识。 |
iConfiguration | 描述该配置的字符串的索引值,如果该值为 0 ,表示没有字符串。 |
bmAttributes | 用来描述设备的一些特性。 |
bMaxPower | 表示设备需要从总线获取的最大电流量,单位为 2 mA。 |