HID class请求

来源:互联网 发布:大学生网络课程 编辑:程序博客网 时间:2024/05/09 22:51

HID class请求

HID设备除了标准的USB请求之外,还有特殊的class请求,首先bRequestType字段定义如下:

bmRequestType:

                         7    数据传输方向

                               0 主机到设备

                               1 设备到主机

                         6~5 类型

                               1 Class

                         4~0 接收者

                               1 Interface


bRequest请求代码定义如下:

0x01                 GET_REPORT

0x02                 GET_IDLE

0x03

0x04~0x08      Reserved

0x09                 SET_REPORT

0x0a                 SET_IDLE            

0x0b                 SET_PROTOCOL


1 GET_REPORT

bmRequestType                         1010001

bRequest                                    GET_REPORT

wValue                                        报告类型和报告ID

wIndex                                        接口

wLength                                      报告长度

该请求用于主机通过控制管道去获取设备报告,报告的类型有:

01              Input

02              Output

03              Feature

04~FF       Reserved


2 GET_IDLE

bmRequestType                         1010001

bRequest                                    SET_REPORT

wValue                                        0和报告ID

wIndex                                         接口

wLength                                      1


3 GET_PROTOCOL

bmRequestType                         1010001

bRequest                                    GET_PROTOCOL

wValue                                        0

wIndex                                         接口

wLength                                      1

返回设备是处于boot protocol还是report protocol,如果设备的SubClass为boot,那么该请求必须支持。


4 SET_REPROT

bmRequestType                         0010001

bRequest                                    SET_REPORT

wValue                                        报告类型和报告ID

wIndex                                         接口

wLength                                      报告长度

该请求用于主机向设备发送报告,该报告为输出报告,例如:USB主机向USB键盘发送的LED显示信息报告。当USB设备没有输出中断端点时,可以通过端点0来发送报告。


5 SET_IDLE

bmRequestType                         0010001

bRequest                                    SET_IDLE

wValue                                        Duration和报告ID

wIndex                                         接口

wLength                                      0


6 SET_PROTOCOL

bmRequestType                         0010001

bRequest                                    SET_PROTOCOL

wValue                                        0 Boot Protocol

                                                   1 Report Protocol

wIndex                                        接口

wLength                                      0

在boot protocol和report protocol之前切换,如果设备的SubClass为boot,那么该请求必须支持。
原创粉丝点击