USB HID Enumeration USB_GET_PROTOCOL

今天在一個新PC平臺上測試USB鍵盤,發現一直枚舉不通過。試想在以前的PC平臺上沒有任何問題為什么這次卻不通過了呢?

使用USB分析儀發現問題出現在USB_GET_PROTOCOL上,以前都是對USB_SET_PROTOCOL進行處理,而USB_GET_PROTOCOL沒用處理過,這次剛好遇到!

原來在USB HID Enumeration期間,PC會詢問設備的PROTOCOL,分為BOOT PROTOCOL  (0X00)和REPORT PROTOCOL (0X01),我再進入BIOS時,在USB_GET_PROTOCOL回復為0X01,在USB_SET_PROTOCOL里面PC設置為0X00,詳情可見下面兩張圖片:

 

這下大家明白了吧:

如果還不明白,可以參考如下網址,對PROTOCOL的詳細介紹

USB HID class: Difference between report protocol and boot protocol?(设计USB键盘进入BIOS会用到)

http://www.eefocus.com/sbogwxf230/blog/2012-05/204299_6313c.html

原文如下:

For USB-HID class: What is the difference between report protocol and boot protocol?

In short, boot protocol is used on BIOS, report protocol is used on OS.

The device capability of boot protocol is shown at the interface triad,
(interfaceClass, interfaceSubclass, interfaceProtocol) field on the HID interface descriptor.
(interfaceClass, interfaceSubclass, interfaceProtocol) = (3, 1, 1): boot keyboard
(interfaceClass, interfaceSubclass, interfaceProtocol) = (3, 1, 2): boot mouse

BIOS checks just this triad, and it recognizes the device (interface) as specified.
BIOS doesn't actually read out report descriptor from the device; It assumes that the device has "standard" keyboard or mouse report descriptor (*1) while the device in boot protocol.
After enumeration, BIOS puts Set_Protocol( BOOT ) to switch the device into boot protocol, if the device has boot capability. While BIOS is running, the device works as keyboard or mouse.
If the device doesn't have boot capability, BIOS doesn't enumerate the device.

At the start up of OS after BIOS, OS puts bus reset. The device gets back to default report protocol.
Usually, OS doesn't put any Set_Protocol, the device is held in report protocol.
On the enumeration, OS reads out report descriptor of the device, and it determines the type of HID device, regardless of above subclass-protocol field.

(*1) see HID spec Appendix B: Boot Interface Descriptors


>2- For keyboard: the input report format is unique for both report/boot protocol?

As I wrote above,
For boot protocol, the report format is fixed one.
For report protocol, you can define any report format on the report descriptor.


>3- When Host send Request(GET_DESCRIPTOR) specifying the report descriptor type, Will Device return the report descriptor including the input report data(i.e: 8-byte for keyboard) ? OR Host need to send Request GET_REPORT to get the input report?

Device returns just the report descriptor, when host puts Get_Descriptor().
Actual input report is sent for Get_Report( input ) request, or for IN transfer over the interrupt IN endpoint.

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值