当前位置:网站首页>8-byte standard request parsing during USB enumeration
8-byte standard request parsing during USB enumeration
2022-08-11 06:35:00 【Emily_rong_2021】
请求
Request and descriptor as,With standard equipment request,For different kinds of equipment,Have their own specific request again.First introduces the standard equipment request,对于特殊的请求,Introduce each different type of equipment,再做解析.
1. Standard equipment request data structure
USB协议中规定,The length of the standard request for8个字节.在设备枚举过程中,HostWill be issued a series of standard request,Devices need to parse the standard request(SETUP事务),And make the right response,Equipment to be successful enumeration.After successful enumeration,To call related interface for data communication.
8Byte standard request structure is as follows:
Each domain analysis in the following table
For a standard request,D6~D5 = 00,USB协议规定了11A standard request,请求码(bRequest)如下表.
Standard request code table
实例:
- 请求数据为8个字节HEX:80 06 00 01 00 00 12 00 ==> 获取设备描述符
注:This stage of the device address(address)用的0,Of course the default endpoint(endpoint)也是0.
第一个字节0x80Break up can get,This is a host to device(bit0~bit4)的一个标准(bit5~bit6)的请求命令,The result of the request is for equipment toHost返回(bit7 == 1).
第二个字节0x06查看表9-4Can be aGET_DESCRIPTOR,Obtaining the descriptor 的请求.
The third four myself is0x0100 ,View the descriptor table,That high bytes descriptor type,01表示设备,02表示配置;Low byte index.Such as equipment has multiple configuration,When the need to read different configuration through the low byte.Or a configuration has multiple interfaces,Through the index to select different interface.So the high byte here1代表 设备,The low byte in this equipment is useless to.
3.3.1 分配地址
- 数据为HEX:00 05 03 00 00 00 00 00 ==> 主机给设备分配地址
注:This stage of the device address(address)用的0,Of course the default endpoint(endpoint)也是0.
第一个字节0x0,This is a host to device(bit0~bit4)的一个标准(bit5~bit6)的请求命令,The result of the request is the host and device to send(bit7 == 0)信息.
第二个字节0x05,从table 9-4可以看到,SET_ADDRESS,From machine is host to set the address.
The third four bytes is together0x03,Reference standard equipment request list,可以知道,This is host to equipment distribution device address3.
3.4.1 Make the request of the phase analysis
- 请求数据为8个字节HEX:80 06 00 01 00 00 12 00 ==> Obtain the device descriptor request
3.5.1 Make the request of the phase analysis
- 请求数据为8个字节HEX:80 06 00 02 00 00 09 00 == > Access to configuration descriptor request
第一个字节0x80Break up can get,This is a host to device(bit0~bit4)的一个标准(bit5~bit6)的请求命令,The result of the request is for equipment toHost返回(bit7 == 1).
第二个字节0x06查看表9-4Can be aGET_DESCRIPTOR,Obtaining the descriptor 的请求.
The third four bytes travels is0x0100 ,View the descriptor table,That high bytes descriptor type,01表示设备,02表示配置;Low byte index.Such as equipment has multiple configuration,When the need to read different configuration through the low byte.Or a configuration has multiple interfaces,Through the index to select different interface.So the high byte here2代表配置,The low byte in this equipment is useless to.
DiSiWu bytes0x0,这个参数如果为0,则不关心;如果为非零,则表示Langurage ID,Every one has a corresponding meaning.
The device class descriptor+配置描述符+接口描述符+端点描述符+厂商定义的描述符The total byte length for the34个字节
- 请求数据为8个字节HEX:80 06 00 03 00 00 FF 00 ==> Get a string descriptor request
The third four bytes travels is0x0300 ,查看9-5描述符表,That high bytes descriptor type,01表示设备,02表示配置,3表示字符串;Low byte index.Such as equipment has multiple configuration,When the need to read different configuration through the low byte.Or a configuration has multiple interfaces,Through the index to select different interface.So the high byte here3表示字符串,Low bytes for the index0.
DiLiuQi bytes0xFF,Represents the data returned should not be more than255个字节.
请求数据为8个字节HEX:80 06 02 03 09 04 FF 00 ==> Get a string descriptor request,索引值为2
The third four bytes travels is0x0302 .So the high byte here3表示字符串,Low bytes for the index2.
DiSiWu bytes0x0409,When the request is string descriptor,则表示Langurage ID,0x0409表示美式英语.
DiLiuQi bytes0xFF,Represents the data returned should not be more than255个字节.
- 请求数据为8个字节HEX:80 06 01 03 09 04 FF 00 ==> Get a string descriptor request,索引值为1
- 请求数据为8个字节HEX:00 09 01 00 00 00 00 00 ==> Set the configuration descriptor request
第一个字节0x80Break up can get,This is a host to device(bit0~bit4)的一个标准(bit5~bit6)的请求命令,The result of the request is host to send device information(bit7 == 0).
第二个字节0x09查看表9-4Can be aSET_CONFIGURATION,Setting the configuration.
The third four bytes travels is0x1,查看9-3Standard request table,To learn that here1Is the value of the configuration.
DiSiWu bytes0x0,In the setup configuration,无意义.
DiLiuQi bytes0x0,In the setup configuration,无意义.
- 请求数据为8个字节HEX: 21 0A 00 00 00 00 00 00
第一个字节0x21Break up can get,这是一个The host to the interface(bit0~bit4)的一个类(bit5~bit6)Request for a particular class命令,请求的结果是The host send interface class command(bit7 == 0).
根据手册:0A表示Set_Idle功能,Set_IdleRequest silences the interrupt input pipe on the specific report,Until the new events or after a specified time.
参考:
边栏推荐
猜你喜欢
Interpretation of the paper: GAN and detection network multi-task/SOD-MTGAN: Small Object Detection via Multi-Task Generative Adversarial Network
JS advanced web page special effects (pink teacher notes)
何凯明新作ViTDET:目标检测领域,颠覆分层backbone理念
stack stack
JVM tuning and finishing
USB 枚举过程中8 字节标准请求解析
OpenMLDB官网升级,神秘贡献者地图带你快速进阶
Day 82
Building a data ecology for feature engineering - Embrace the open source ecology, OpenMLDB fully opens up the MLOps ecological tool chain
STM32学习笔记(白话文理解版)—按键控制
随机推荐
umi约定式路由规则修改
[Meetup]OpenMLDBxDolphinScheduler 链接特征工程与调度环节,打造端到端MLOps工作流
使用c语言实现井字棋(有源码,可以直接运行)
IIC and SPI
STM32F407-浅~~析UART异步通信&USART_Init函数入口参数
论文解读:跨模态/多光谱/多模态检测 Cross-Modality Fusion Transformer for Multispectral Object Detection
OpenMLDB:线上线下一致的生产级特征计算平台
JVM tuning and finishing
mk文件介绍
OpenMLDB v0.5.0 released | Performance, cost, flexibility reach new heights
精彩联动 | OpenMLDB Pulsar Connector原理和实操
Tinker接入全流程---编译篇
Fourth Paradigm OpenMLDB optimization innovation paper was accepted by VLDB, the top international database association
Day 85
C语言的编译
SearchGuard证书配置
js 学习进阶(Dom部分 pink老师教学笔记)
C语言实现猜数字(附带源码,可直接运行)
NUC980-镜像烧录
ActiveReports报表分类之页面报表