dlkj/usbd-human-interface-device

[Question] read_report only works the first time

Closed this issue ยท 2 comments

Want to start this off with a big thanks for the library ๐Ÿ™‡ It's made my life much easier especially as a complete beginner in embedded devices.

Firstly this is probably an issue with my code as opposed to the library. I have followed the examples and the device implementation for Keyboard. Basically I've implemented a custom HID interface that will represent a pedal (for sim racing). It has an Z axis which atm can be set using a potentiometer. That works fine and I have even tested it in a game. However I need to be able to also send data to the device (Raspberry Pico) for example when ABS is engaged. For the purpose I've defined an output endpoint with the size of 1 byte. That's also working but only the first time I write to the device and any subsequent writes don't appear to be read.

https://github.com/gmartsenkov/active-pedals-client - How I read/write to the device
https://github.com/gmartsenkov/active-pedals - This is running on the Pico

Nvm, writing to the device in a loop (every 10ms) seem to resolve the issue. I'm guessing this is obvious to the more knowledgable folks.

dlkj commented

No problem. Glad you got it working!