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

配置描述符抓包

配置描述符的数据格式

  • 0x09 bLength字段。配置描述符的长度为9字节
  • 0x02 bDescriptorType字段。配置描述符编号为0x02
  • 0x22 wTotalLength字段。配置描述符集合的总长度,包括配置描述符本身、接口描述符、类描述符、端点描述符等,LSB
  • 0x00
  • 0x01 bNumInterfaces字段。该配置包含的接口数,只有一个接口
  • 0x01 bConfiguration字段。该配置的值为1
  • 0x00 iConfigurationz字段,该配置的字符串索引。这里没有,为0
  • 0xA0 bmAttributes字段,该设备的属性
  • 0x32 bMaxPower字段,该设备需要的最大电流量。每单位电流为 2 mA

USB鼠标-配置描述符(三)相关推荐

  1. USB鼠标-字符串描述符(七)

    USB 鼠标详解阅读顺序 1.枚举 2.设备描述符 3.设置地址 4.配置描述符 5.接口描述符 6.HID 描述符 7.端点描述符 8.字符串描述符 9.HID 报告描述符 10.HID 报告的返回 ...

  2. 【USB笔记】配置描述符Configuration Descriptor

    USB笔记 配置描述符(Configuration Descriptor) 配置描述符(Configuration Descriptor)说明了一个特定配置的相关信息.取得设备描述符(Device D ...

  3. 32 usb 配置描述符_USB协议详解第4讲(USB描述符标准配置描述符)

    关注+星标公众号,不错过精彩内容 编排 | 一个早起的程序员 一个早起的程序员 1 USB描述符USB描述符有设备描述符.标准配置描述符.接口描述符.端点描述符.字符串描述符,HID设备有HID描述符 ...

  4. USB设备多个配置描述符的获取过程

    多配置USB设备枚举过程和多字符串描述符的枚举是相同的,过程如下: 1. 总线复位: 2. 获取设备描述符: 3. 总线复位: 4. 设置地址: 5. 获取设备描述符: 6. 获取配置描述符1: 7. ...

  5. USB描述符(附加USB HID报告描述符 )

    USB描述符介绍 USB描述符是主机识别USB设备的依据,主机根据设备的描述符来加载相应的驱动 USB描述符的作用 USB描述符信息存储在USB设备中,在枚举过程中,USB主机会向USB设备发送Get ...

  6. USB的端点描述符详解-重新排版

    USB的端点描述符详解 端点描述符,是描述USB通信通道或管道的类型和功能的标准USB描述符. 端点描述符和接口描述符还有配置描述符一样,不能单独发送给USB主机,需要以配置描述符集合的形式发送给主机 ...

  7. USB学习3-USB描述符

    本片博客是基于对韦东山老师的USB相关学习视频.<USB2.0>.<MindShare USB 3.0 Technology>.<vdocuments.mx_univer ...

  8. linux内核中的文件描述符(三)--fd的回收

    linux内核中的文件描述符(三)--fd的回收 Kernel version:2.6.14 CPU architecture:ARM920T Author:ce123(http://blog.csd ...

  9. Linux那些事儿 之 戏说USB(33)字符串描述符

    关于字符串描述符,前面的前面已经简单描述过了,地位仅次于设备/配置/接口/端点四大描述符,那四大设备必须得支持,而字符串描述符对设备来说则是可选的. 这并不是就说字符串描述符不重要,对咱们来说,字符串 ...

最新文章

  1. 使用plsql developer连接centos7上的oracle数据库
  2. LeetCode 121 Best Time to Buy and Sell Stock
  3. Python借助队列实现进程通信
  4. jQuery Vue的CDN
  5. 3-pycharm找不到库的解决办法
  6. 详解Spring框架的依赖注入
  7. 光棍节脱单,单身狗该你上了
  8. 全栈开发工程师微信小程序-上(中)
  9. 第一次作业_U201410737 _万学远
  10. 基于人机环境系统工程的智慧企业建设思考
  11. 英语四级备考~自我总结
  12. 使用Javascript 实现 分享到 新浪微博 QQ 空间等
  13. 第二工业大学计算机应用大专录取分,二工大| 2018年上海第二工业大学专科层次依法自主招生各专业最低录取分数线...
  14. Python在Linux环境下Word转PDF
  15. 将Spring Boot应用程序迁移到Java 9-模块
  16. 【系列笔记一】-USYD悉尼大学Data1002 Grok Module 3 课件 作业 assignment讲解
  17. 2021-06-17springboot本地正常启动,部属服务器找不到外部文件 file:/apps/xxx/xxx/xxx.jar!/BOOT-INF/classes!/
  18. 《梵高》-孤独的天才
  19. Web安全之SQL注入漏洞学习(一)
  20. C盘清理-我的C盘莫名其妙就满了?

热门文章

  1. 美国留学计算机申请,美国留学 留学热门计算机专业的申请介绍
  2. 我用wxPython搭建GUI量化系统之财务选股工具与股票行情界面切换
  3. 哪些情况下企业需要支付经济补偿金
  4. springcloud学习笔记一
  5. Unity角色残影特效
  6. Electron相关知识点
  7. 基于前端Vue后端.NetCore Web后台管理系统通用开本框架采用前后端分离技术,前端使用vue2.6.0,后端使用.netcore3.1,支持跨平台、多租户
  8. 百万前端之VUE 2.X + vant 实现关键字搜索内容 搜索记录、热搜
  9. 基于STM32+ESP8266+TFTLCD的天气预报显示
  10. 开发者大会倒计时7天!「视觉AI开发平台及其行业应用论坛」等你来