-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
When clearing an endpoint stall, reset DTOG #1537
Conversation
(I've force-pushed this branch with a revision to clean up handling of default control pipe.) I've convinced myself that this patch removes some bugs, but we still need to examine how endpoint halts interact with class libraries and in-progress transfers. In particular, I'm worried about race conditions like:
A possible deadlock may be:
Another issue is the case that the class driver wants to reject the endpoint halt from being cleared. |
@hathach could you possibly review this PR as well? I process 1,2MSPS (yes, I know, the ADC is a little overclocked) in the background. This works ok, but I get timeouts under linux from py-usbtmc during stress-testing. Applying this change fixes at least for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the Pr, I am so sorry for late response. I have rebase and update PR to skip the local endpoint stalled status, and just carry the request from host i.e clear stall even if it is not stalled previously. This will pass to the dcd which should reset data toggle. In case dt is not reset, it is bug from dcd and should be fixed there.
According to the USB spec, the DTOG of an endpoint should always be reset to DATA0 when receiving CLEAR_FEATURE(ENDPOINT_HALT), regardless of if the endpoint had been stalled (See citations in #1529).
I believe the attached changes should be made to USBD to facilitate this requirement.
However, some issues to discuss are:
usbd_edpt_clear_stall
unconditionally clear the stall... but does that run into race conditions?(If this is merged, then the workaround in #1531 can be removed from the USBTMC driver)