USB HID class: Difference between report protocol and boot protocol?
I would like to know:
1- For USB-HID class: What is the difference between report protocol and boot protocol?
2- For keyboard: the input report format is unique for both report/boot protocol?
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?
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
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.
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.
这篇文章简单介绍了一下USB键盘鼠标report protocol 和 boot protocol的差别，个人理解二者的差别是 Boot Protocol已经规定出来了发送数据的格式，这样在无需解析 HID 协议的情况下，可以直接解读出来键值等有用的信息，如果USB HOST资源有限，这样可以方便使用。比如：BIOS 中使用这个协议方便Setup处理。 report protocol 的话，就是标准的HID协议，需要根据Descriptor才能得知具体含义。