-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UsbClass::poll not always called on UsbDevice::poll #32
Comments
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 The issue is, of course, when there are no logs to be written. In that case |
Slightly offtopic: have you tried |
The Logger is actually a wrapper around |
Then it should start sending when you |
It does. The issue is that the initial write is never triggered because it happens during |
@mvirkkunen, any thoughts? I think that the current behavior is correct and the documentation is wrong, but who knows. |
Hmm.. good question! Calling it only when data is received is somewhat redundant because the specific methods ( However the correct way to implement this would be to proactively write into the endpoint outside of Honestly I don't remember what |
I'd be ~fine with that, I was mostly annoyed at the confusion / misleading information.
Yes, my solution here was to simply trigger the interrupt manually, if necessary. The reason for triggering the initial write during the interrupt is simplified ownership of the The reason for having the logic execute automatically during |
That sounds like a feasible use case. I wonder if it'd be best for |
Yeah, I'm not sure about the best design here either. Maybe one option would be to keep
|
In the next version (in the endpoint-trait branch), UsbClass::poll has been changed so that it is called on every poll while the device is connected, and it gets an "event" object that has the device state as well as methods for checking which endpoints have has events occur (the data from PollResult, and it now replaces endpoint_out/endpoint_in_complete) |
I just ran in to this same issue, the endpoint-trait approach sounds like a good solution! |
Contrary to what is documented on
UsbClass::poll
("Called whenever theUsbDevice
is polled."), it is only called byUsbDevice::poll
whenUsbBus::poll
returnsPollResult::Data
.Is that working as intended with the documentation being wrong or does the documentation need to be updated?
The text was updated successfully, but these errors were encountered: