当前位置:网站首页>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.

参考:
边栏推荐
- OpenMLDB v0.5.0 released | Performance, cost, flexibility reach new heights
- Jetpack使用异常问题集锦
- typescript学习日记,从基础到进阶(第二章)
- Visual studio2019 configuration uses pthread
- 【Meetup预告】OpenMLDB+OneFlow:链接特征工程到模型训练,加速机器学习模型开发
- Day 70
- ARM 汇编指令 ADR 与 LDR 使用
- Pinyougou project combat notes
- ARM assembly instruction ADR and LDR
- 谨此留个纪念
猜你喜欢

STM32学习笔记(白话文理解版)—外部IO中断实验

gerrit 配置SSH Key和账号、邮箱信息

127.0.0.1 已拒绝连接

智能风控中台设计与落地

Fourth Paradigm OpenMLDB optimization innovation paper was accepted by VLDB, the top international database association

Interpretation of the paper: Cross-Modality Fusion Transformer for Multispectral Object Detection

Day 87

Day 76

Day 82

vscode插件开发——代码提示、代码补全、代码分析(续)
随机推荐
USB中用NRZI来编码数据
OpenMLDB v0.5.0 released | Performance, cost, flexibility reach new heights
Event Preview | On April 23, a number of wonderful sharing sessions of OpenMLDB will come, which will live up to the good time of the weekend
蓝牙技术-简介
JS case exercise (classic case of teacher pink)
Goldbach's conjecture and the ring of integers
vscode插件开发——代码提示、代码补全、代码分析
字节(byte)和位(bit)
Compilation exception resolution
论文解读:GAN与检测网络多任务/SOD-MTGAN: Small Object Detection via Multi-Task Generative Adversarial Network
umi约定式路由规则修改
JS案例练习(pink老师经典案例)
场景驱动的特征计算方式OpenMLDB,高效实现“现算先用”
实时特征计算平台架构方法论和基于 OpenMLDB 的实践
STM32-中断优先级管理NVIC
第四范式OpenMLDB优化创新论文被国际数据库顶会VLDB录用
ARM 汇编指令 ADR 与 LDR 使用
js写四位随机数能有多少种可能性?并列出所有可能性
【Meetup预告】OpenMLDB+OneFlow:链接特征工程到模型训练,加速机器学习模型开发
Day 84