dlkj/usbd-human-interface-device

Issues getting read_report to work

Closed this issue · 2 comments

0xa10 commented

Hi, Ive gotten my input descriptor working - a simple descriptor with 3 bits corresponding to 3 usage items, and 5 bits padding.
My input report is being serialized as expected and everything works fine on the device-to-host front.

My next goal is implementing a host-to-device communications - specifically - I want to be able to issue an output report which will instruct the device to reset into BOOTSEL mode.

  1. Im pretty sure doing it over HID content reports is not the best way, I thought of adding an additional USB output endpoint but that seems even more cluttered. Is there a better way to do this without going completely out of my way?
  2. I'm having no luck in sending reports back to the device. To start off - I used the basic LED keyboard report, just to make sure the issue isnt with the way my descriptor is built.
    However, every time I send a report back from my host - all my main thread logic dies, and I'm left with just the USB IRQ running in the background. No exception/panic, no defmt output. I'm not even sure how to to debug this.

Has anyone experienced a similar issue? The only thing I can think of that's different than the example code is that I'm using RTIC and running both my read/write report logic in a task which runs every 10ms (corresponding with the endpoint polling intervals.)

Any ideas/advice would be greatly appreciated.

dlkj commented

Sending data back via a host report would be the way to go. Working from the keyboard led report is one way to start on this. You either want to define a custom usb HID device and write a host driver or look at something generic like the linux HID I/O Transport Driver - https://docs.kernel.org/hid/hid-transport.html

With regard to the system dying, ensure you are regularly calling the usb poll method and reading any reports.

dlkj commented

Closing due to lack of response.