1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > USB鼠标-配置描述符(三)

USB鼠标-配置描述符(三)

时间:2018-09-11 12:09:25

相关推荐

USB鼠标-配置描述符(三)

USB鼠标详解阅读顺序

1、枚举

2、设备描述符

3、设置地址

4、配置描述符

5、接口描述符

6、HID 描述符

7、端点描述符

8、字符串描述符

9、HID 报告描述符

10、HID 报告的返回

配置描述符定义

配置描述符结构

typedef struct __attribute__ ((packed)){uint8_t bLength ; ///< Size of this descriptor in bytesuint8_t bDescriptorType; ///< CONFIGURATION Descriptor Typeuint16_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 configurationuint8_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 configurationuint8_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;

bLength:配置描述符的长度。标准的 USB配置描述符的长度为 9字节bDescriptorType:描述符的类型。配置描述符的类型编码为 0x02wTotalLength:2个字节,表示整个配置描述符集合的总长度,包括配置描述符,接口描述符,类特殊描述符(如果有)和端点描述符,注意低字节在前。bNumInterfaces:表示该配置所支持的接口数量。通常功能单一的设备只具有一个接口,而复合设备则具有多个接口bConfiguration:表示该配置的值。通常一个 USB设备可以支持多个配置,bConfiguration就是每个配置的标识iConfiguration:描述该配置的字符串的索引值,如果该值为 0 ,表示没有字符串bmAttributes:用来描述设备的一些特性bMaxPower:表示设备需要从总线获取的最大电流量,单位为 2 mA。

配置描述符抓包

配置描述符的数据格式

0x09bLength字段。配置描述符的长度为9字节0x02bDescriptorType字段。配置描述符编号为0x020x22wTotalLength字段。配置描述符集合的总长度,包括配置描述符本身、接口描述符、类描述符、端点描述符等,LSB0x000x01bNumInterfaces字段。该配置包含的接口数,只有一个接口0x01bConfiguration字段。该配置的值为10x00iConfigurationz字段,该配置的字符串索引。这里没有,为00xA0bmAttributes字段,该设备的属性0x32bMaxPower字段,该设备需要的最大电流量。每单位电流为 2 mA

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。