USB笔记 设备功能描述符(Device Capability Descriptor)
设备功能描述符(Device Capability Descriptor)是用于存储特定某项技术或设备功能信息的描述符,和BOS描述符(BOS Descriptor)一起由Wireless Universal Serial Bus Specification Revision 1.0规范引入,之后在USB 2.0 ECN: Link Power Management (LPM) 、USB3.x Specification、Microsoft OS 2.0 Descriptors Specification 等协议规范都加入了定义。
单个的特定技术或者通用的设备层级的功能通过设备功能描述符(Device Capability Descriptor)来上报。设备功能描述符(Device Capability Descriptor)总是作为GetDescriptor(BOS)请求返回的BOS信息的一部分返回。主机端不能单独读取单个的设备功能描述符(Device Capability Descriptor),无法使用GetDescriptor()或SetDescriptor()请求直接读取或设置单独的设备功能,只能通过GetDescriptor()请求获取BOS描述符(BOS Descriptor)并通过wTotalLength字段得到长度来读取整个描述符集。
设备功能描述符(Device Capability Descriptor)具有通用头(generic header),带有子类型字段(bDevCapabilityType),这个字段定义了描述符其余部分的布局(layout)。
Device Capability Descriptor
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | Number | 以字节为单位的描述符大小 |
1 | bDescriptorType | 1 | Constant | 设备功能描述符类型 |
2 | bDevCapabilityType | 1 | Number | 设备功能类型 |
3 | Capability-Dependent | Var | Variable | 特定功能的格式 |
bLength以字节为单位的描述符大小。
bDescriptorType设备功能描述符类型,为DEVICE CAPABILITY(0x10)。
bDevCapabilityType 设备功能类型。
Capability Code | Value | Description | Specification |
---|---|---|---|
Wireless_USB | 01H | 定义一组特定于无线USB的设备级功能 | Wireless Universal Serial Bus Specification |
USB 2.0 EXTENSION | 02H | USB2.0拓展描述符 | Universal Serial Bus 3.x Specification |
SUPERSPEED_USB | 03H | 定义一组特定于超高速USB的设备级功能 | Universal Serial Bus 3.x Specification |
CONTAINER_ID | 04H | 定义用于在所有操作模式下标识实例的实例唯一ID | Universal Serial Bus 3.x Specification |
PLATFORM | 05H | 定义特定于特定平台/操作系统的设备功能 | Microsoft OS 2.0 Descriptors Specification Universal Serial Bus 3.x Specification |
POWER_DELIVERY_CAPABILITY | 06H | 定义此设备的各种PD功能 | Universal Serial Bus Power Delivery Specification |
BATTERY_INFO_CAPABILITY | 07H | 提供设备支持的每个电池的信息 | Universal Serial Bus Power Delivery Specification |
PD_CONSUMER_PORT_CAPABILITY | 08H | 描述功耗特性和功能 | Universal Serial Bus Power Delivery Specification |
PD_PROVIDER_PORT_CAPABILITY | 09H | 描述电源提供特性和功能 | Universal Serial Bus Power Delivery Specification |
SUPERSPEED_PLUS | 0AH | 定义一组特定于SuperSpeed Plus USB设备级的功能 | Universal Serial Bus 3.x Specification |
PRECISION_TIME_MEASUREMENT | 0BH | 精密时间测量(PTM)功能描述符 | Universal Serial Bus 3.x Specification |
Wireless_USB_Ext | 0CH | 定义一组特定于无线USB 1.1的设备级功能 | |
BILLBOARD | 0DH | Billboard capability | 懒得找了 |
AUTHENTICATION | 0EH | Authentication Capability Descriptor | 懒得找了 |
BILLBOARD_EX | 0FH | Billboard Ex capability | 懒得找了 |
CONFIGURATION SUMMARY | 10H | 汇总设备实现的功能的配置信息 | Universal Serial Bus 3.x Specification |
Reserved | 00H, 11-FFH | 保留供将来使用 注意:最新的设备功能类型代码(Device Capability Type Codes)将在usb.org上列出。 |
Capability-Dependent 取决于bDevCapabilityType。
获取设备功能描述符
主机通过发送Get Descriptor
请求,取得BOS描述符及其子描述符。设备功能描述符(Device Capability Descriptor)总是作为BOS描述符的一部分返回。
Get Descriptor | Value |
---|---|
bmRequestType | 0x80 |
bmRequestType.Recipient | 0b00000(Device) |
bmRequestType.Type | 0b00(Standard) |
bmRequestType.Direction | 0b1(Device-to-Host) |
bRequest | 0x06(Get Descriptor) |
wValue | 0x0f00(BOS#0) |
wIndex | 0x0000 |
wLength | 0x??? |
下面举例说明一个获取设备功能描述符(Device Capability Descriptor)的过程。使用USB分析仪抓包,软件Total Phase Data Center。
获取一个设备的设备功能描述符(Device Capability Descriptor),该设备的设备功能描述符(Device Capability Descriptor)如下所示,这是一个USB 2.0 Extension Descriptor:
使用USB分析仪抓包可以看到,获取BOS描述符(BOS Descriptor),而设备功能描述符(Device Capability Descriptor)就包含在其中:
设备功能描述符(Device Capability Descriptor)的获取过程如下:
再展开看到详细的过程:
接下来详细看整个获取过程的各个字段含义:
一开始的setup包过程:
setup data:
IN包过程
OUT包过程:
完成整个设备功能描述符(Device Capability Descriptor)的获取。
附录
Wireless USB 1.x Device Capability Descriptor
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | Number | Size of this descriptor. |
1 | bDescriptorType | 1 | Constant | Descriptor type: DEVICE CAPABILITY Type. |
2 | bDevCapabilityType | 1 | Number | Valid values are listed in Table 7-24. |
3 | Capability-Dependent | Var | Variable | Capability-specific format. |
Wireless USB 1.0 Device Capability Type Codes
Capability Code | Value | Description |
---|---|---|
Wireless_USB | 01H | Defines the set of Wireless USB-specific device level capabilities. |
Reserved | 00H, 02-FFH | Reserved for future use. |
Wireless USB 1.1 Device Capability Type Codes
Capability Code | Value | Description |
---|---|---|
Wireless_USB | 01H | Defines the set of Wireless USB-specific device level capabilities. |
Wireless_USB_Ext | 02H | Defines the set of Wireless USB 1.1-specific device level capabilities. |
Reserved | 00H, 03-FFH | Reserved for future use. |
USB 3.x Device Capability Descriptor
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | Number | Size of this descriptor. |
1 | bDescriptorType | 1 | Constant | Descriptor type: DEVICE CAPABILITY Type. |
2 | bDevCapabilityType | 1 | Number | Valid values are listed in Table 9-14. |
3 | Capability-Dependent | Var | Variable | Capability-specific format. |
USB 3.0 Device Capability Type Codes
Capability Code | Value | Description |
---|---|---|
Wireless_USB | 01H | Defines the set of Wireless USB-specific device level capabilities |
USB 2.0 EXTENSION | 02H | USB 2.0 Extension Descriptor |
SUPERSPEED_USB | 03H | Defines the set of SuperSpeed USB specific device level capabilities |
CONTAINER_ID | 04H | Defines the instance unique ID used to identify the instance across all operating modes |
Reserved | 00H, 05-FFH | Reserved for future use |
USB 3.1 Device Capability Type Codes
Capability Code | Value | Description |
---|---|---|
Wireless_USB | 01H | Defines the set of Wireless USB-specific device level capabilities |
USB 2.0 EXTENSION | 02H | USB 2.0 Extension Descriptor |
SUPERSPEED_USB | 03H | Defines the set of SuperSpeed USB specific device level capabilities |
CONTAINER_ID | 04H | Defines the instance unique ID used to identify the instance across all operating modes |
PLATFORM | 05H | Defines a device capability specific to a particular platform/operating system |
POWER_DELIVERY_CAPABILITY | 06H | Defines the various PD Capabilities of this device |
BATTERY_INFO_CAPABILITY | 07H | Provides information on each battery supported by the device |
PD_CONSUMER_PORT_CAPABILITY | 08H | The consumer characteristics of a port on the device |
PD_PROVIDER_PORT_CAPABILITY | 09H | The provider characteristics of a port on the device |
SUPERSPEED_PLUS | 0AH | Defines the set of SuperSpeed Plus USB specific device level capabilities |
PRECISION_TIME_MEASUREMENT | 0BH | Precision Time Measurement (PTM) Capability Descriptor |
Wireless_USB_Ext | 0CH | Defines the set of Wireless USB 1.1-specific device level capabilities |
Reserved | 00H, 0D-FFH | Reserved for future use |
USB 3.2 Device Capability Type Codes
Capability Code | Value | Description |
---|---|---|
Wireless_USB | 01H | Defines the set of Wireless USB-specific device level capabilities |
USB 2.0 EXTENSION | 02H | USB 2.0 Extension Descriptor |
SUPERSPEED_USB | 03H | Defines the set of SuperSpeed USB specific device level capabilities |
CONTAINER_ID | 04H | Defines the instance unique ID used to identify the instance across all operating modes |
PLATFORM | 05H | Defines a device capability specific to a particular platform/operating system |
POWER_DELIVERY_CAPABILITY | 06H | Defines the various PD Capabilities of this device |
BATTERY_INFO_CAPABILITY | 07H | Provides information on each battery supported by the device |
PD_CONSUMER_PORT_CAPABILITY | 08H | The consumer characteristics of a port on the device |
PD_PROVIDER_PORT_CAPABILITY | 09H | The provider characteristics of a port on the device |
SUPERSPEED_PLUS | 0AH | Defines the set of SuperSpeed Plus USB specific device level capabilities |
PRECISION_TIME_MEASUREMENT | 0BH | Precision Time Measurement (PTM) Capability Descriptor |
Wireless_USB_Ext | 0CH | Defines the set of Wireless USB 1.1-specific device level capabilities |
BILLBOARD | 0DH | Billboard capability |
AUTHENTICATION | 0EH | Authentication Capability Descriptor |
BILLBOARD_EX | 0FH | Billboard Ex capability |
CONFIGURATION SUMMARY | 10H | Summarizes configuration information for a function implemented by the device |
Reserved | 00H, 11-FFH | Reserved for future use Note: The most up-to-date Device Capability Type Codes will be listed on usb.org. |
[参考资料]
Universal Serial Bus Specification Revision 2.0
Universal Serial Bus 3.0 Specification
Universal Serial Bus 3.1 Specification
Universal Serial Bus 3.2 Specification
Wireless Universal Serial Bus Specification Revision 1.0
Wireless Universal Serial Bus Specification Revision 1.1
USB 2.0 ECN: Link Power Management (LPM)
Universal Serial Bus Power Delivery Specification Revision 2.0, V1.2
Universal Serial Bus Power Delivery Specification Revision 2.0, V1.3
Universal Serial Bus Power Delivery Specification Revision 3.0, Version 2.0 + ECNs
Microsoft OS 2.0 Descriptors Specification
USB Complete, 5th Edition
USB开发大全
本文链接:https://blog.csdn.net/u012028275/article/details/109955356