A device descriptor describes general information about a USB device. It includes information that applies globally to the device and all of the device’s configurations. A USB device has only one device descriptor.

    All USB devices have a Default Control Pipe. The maximum packet size of a device’s Default Control Pipe is described in the device descriptor. Endpoints specific to a configuration and its interface(s) are described in the configuration descriptor. A configuration and its interface(s) do not include an endpoint descriptor for the Default Control Pipe. Other than the maximum packet size, the characteristics of the Default Control Pipe are defined by this specification and are the same for all USB devices.

    The bNumConfigurations field identifies the number of configurations the device supports. Table 9-7 shows the standard device descriptor.


    设备描述符描述了有关 USB 设备的通用信息。它包含全局性地应用于该设备及其所有配置的信息。一个 USB 设备只有一个设备描述符

    所有 USB 设备都有一个默认控制管道。设备的默认控制管道的最大数据包大小在设备描述符中描述。特定于某个配置及其接口的端点则在配置描述符中描述。一个配置及其接口的描述中不包含默认控制管道的端点描述符。除最大数据包大小外,默认控制管道的特性由本规范定义,并且对所有 USB 设备都是相同的。

    bNumConfigurations 字段标识了设备支持的配置数量。表 9-7 显示了标准的设备描述符。

    表 9-7. 标准设备描述符

    偏移量 字段 大小 值类型 描述
    0 bLength 1 数字 此描述符的大小(以字节为单位)
    1 bDescriptorType 1 常量 设备描述符类型
    2 bcdUSB 2 BCD码 以二进制编码十进制表示的USB规范版本号(例如,2.10 表示为 210H)。此字段标识设备和其描述符所遵循的USB规范发布版本。
    4 bDeviceClass 1 类代码(由USB分配)
    5 bDeviceSubClass 1 子类 子类代码(由USB分配)。这些代码由 bDeviceClass 字段的值限定。
    如果 bDeviceClass 字段重置为零,则此字段也必须重置为零。
    如果 bDeviceClass 字段未设置为 FFH,则所有值均保留由USB分配。
    6 bDeviceProtocol 1 协议代码 协议代码(由 USB 分配)。 这些代码由 bDeviceClassbDeviceSubClass 字段的值限定。
    如果设备在设备级别支持特定于类的协议,此代码用于标识设备所使用的、由设备类规范定义的协议。
    如果此字段重置为零,则表示设备在设备级别不使用特定于类的协议。但是,它可能在接口级别使用特定于类的协议。
    如果此字段设置为 FFH,则表示设备在设备级别使用厂商特定的协议。
    7 bMaxPacketSize0 1 数字 端点零的最大数据包大小(仅 8, 16, 32 或 64 为有效值)。
    8 idVendor 2 ID 厂商 ID(由 USB-IF 分配)。
    10 idProduct 2 ID 产品 ID(由制造商分配)。
    12 bcdDevice 2 BCD 设备版本号(以二进制编码十进制表示)。
    14 iManufacturer 1 索引 描述制造商的字符串描述符的索引。
    15 iProduct 1 索引 描述产品的字符串描述符的索引。
    16 iSerialNumber 1 索引 描述设备序列号的字符串描述符的索引。
    17 bNumConfigurations 1 数字 设备支持的(可能的)配置数量。