Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4988

General • Re: Adding MS OS descriptors to USB dev_lowlevel example

$
0
0
I recently got this working. Here's what I had to do.
  1. Change the device descriptors .bcdUSB field to 0x0210. 0x0200 and 0x0110 won't work if you want to use Microsoft's OS 2.0 descriptors.
  2. In `usb_handle_setup_packet` you have to handle more cases than just `USB_DIR_OUT` and `USB_DIR_IN`. You need to handle the case where `pkt->bmRequestType` is `0xC0`. Print out the fields of `pkt` to see what Windows is doing when you plug in your Pico.
  3. In the `descriptor_type` switch statement, you need to handle the `case 0x0F:` for getting the BOS descriptor. You might also need to handle `case 0x06:` which is the Device Qualifier Descriptor.
  4. Then you need to send the descriptors back to the host, which is a major PITA to get right. https://github.com/newaetech/naeusb/blob/main/wcid.md helped me get that sorted.
  5. Finally, you'll find that you need to send more than 64 bytes back to the host. To do that, you will need to modify `ep0_in_handler` to repeatedly send any remaining bytes, when the data to be sent exceeds 64 bytes.
I hope that helps.

Statistics: Posted by JinShil — Wed Jun 12, 2024 8:41 am



Viewing all articles
Browse latest Browse all 4988

Trending Articles