usb之配置描述符

配置描述符的打印是有 设备描述符中一个成员 __u8 bNumConfigurations; 打印出来的
struct usb_config_descriptor {
__u8 bLength;
__u8 bDescriptorType;

__le16 wTotalLength;
__u8  bNumInterfaces;
__u8  bConfigurationValue;
__u8  iConfiguration;
__u8  bmAttributes;
__u8  bMaxPower;

} attribute ((packed));

struct usb_config_descriptor config;

for(i=0;i<desc.bNumConfigurations;i++)
{
printf("config.bLength %d ",config.bLength);
printf("config.bDescriptorType is %d ",config.bDescriptorType);
printf("config.wTotalLength is %d ",config.wTotalLength);
printf("config.bNumInterfaces is %d ",config.bNumInterfaces);
printf("config.bConfigurationValue is %d ",config.bConfigurationValue);
printf("config.iConfiguration is %d ",config.iConfiguration);
printf("config.bmAttributes is %d ",config.bmAttributes);
printf("config.bMaxPower is %d ",config.bMaxPower);
}

一勤天下无难事。
原文地址:https://www.cnblogs.com/nowroot/p/14131303.html