-
Notifications
You must be signed in to change notification settings - Fork 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
Implement usbh replug on pico #1193
Implement usbh replug on pico #1193
Conversation
fcaf272
to
3e3fe1e
Compare
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 very much for the PR. I have been busy with other works, and only have time to review this now. It is a great fix. host stack apparently needs more dev time. Though I found the while() with find_first loop is not sufficient. We are better with just 1 for loop to close endpoint.
Therefore I have update the PR (also rebased since master has several updates).
PS: confirmed that it fix #1192, probably fix issue raspberrypi/pico-sdk#483 as well.
while (ep) | ||
{ | ||
// in case it is an interrupt endpoint, disable it | ||
usb_hw_clear->int_ep_ctrl = (1 << (ep->interrupt_num + 1)); | ||
usb_hw->int_ep_addr_ctrl[ep->interrupt_num] = 0; | ||
// unconfigure the endpoint | ||
ep->configured = false; | ||
*ep->endpoint_control = 0; | ||
*ep->buffer_control = 0; | ||
hw_endpoint_reset_transfer(ep); | ||
ep->dev_addr = ADDR_INVALID; // don't find this one again | ||
ep = _hw_find_first_endpoint(dev_addr); | ||
} |
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.
this loop is not sufficient, we should do only 1 for loop to close endpoint with matched address
PS: updated with latest push
This pull request resolves issue #1192 in my testing.
When I was debugging the issue, I found that the host could not send report requests because the endpoint was claimed already. The first commit implements hcd_device_close() more completely so the hardware does not think the endpoints are doing anything and the second commit clears the claimed and busy flags for the device endpoints.
I am very new to this project. Is directly clearing the claimed and busy flags safe?