profile
viewpoint

Ask questionsUsbClass::poll not always called on UsbDevice::poll

Contrary to what is documented on UsbClass::poll ("Called whenever the UsbDevice is polled."), it is only called by UsbDevice::poll when UsbBus::poll returns PollResult::Data.

Is that working as intended with the documentation being wrong or does the documentation need to be updated?

mvirkkunen/usb-device

Answer questions TimNN

Maybe to provide a bit of context: I've been working USB Serial Logger implementation. The logs are initially written to an internal buffer. Whenever endpoint_in_complete is called, the buffer is checked and if logs are present they are written.

The issue is, of course, when there are no logs to be written. In that case endpoint_in_complete will never be called again. Based on the documentation, I implemented poll so that it would periodically also check the buffer and trigger an initial write if necessary. I few hours of debugging later, I noticed that my poll method wasn't actually called 😑.

useful!

Related questions

No questions were found.
Github User Rank List