Today, I installed a USB flash drive on a new PC platform and found that I had never been able to access it. I think there is no problem in the previous PC platform. Why can't this problem be solved?
When I used USB analysis, I found that the problem occurred on usb_get_protocol. I used to handle usb_set_protocol, but usb_get_protocol didn't handle it. This is a good time!
Previously, during the USB hid enumeration period, the PC will ask the protocol of the preset, which is divided into Boot Protocol (0x00) and report protocol (0x01 ), when I enter the bios again, the return value of usb_get_protocol is 0x01. In usb_set_protocol, the PC value is set to 0x00. The following two images are displayed:
Now everyone understands:
If you still do not understand, you can refer to the following website to introduce Protocol
USB hid class: difference between report protocol and boot protocol? (It is used to design a USB keyboard to enter the BIOS)
Http://www.eefocus.com/sbogwxf230/blog/2012-05/204299_6313c.html
The original article is as follows:
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.