-
Notifications
You must be signed in to change notification settings - Fork 7.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
USB host crash on remove device (IDFGH-5797) #7505
Comments
I have another bug/crash in USB host.
|
It would be nice if this could be fixed. Adding to the first issue I also noticed that the crash seems to be before the client callback is called. So the below code is not executed.
|
@leemagnusson We have already have a fix in the works pending an internal review. |
This commit fixes how the USBH handling of a sudden device disconnection, more specifically handling of device gone. - Previously the USBH would only halt, flush, and dequeue the device's default EP, then send a device gone event to the Host Library layer. - Now the USBH will also halt and flush all non-default EPs, allowing all of the URBs to be dequeud. - Some internal object members are now protected by a mutex instead of a spinlock. Closes #7505
Hi @Dazza0 Logs seems to be ok on first look, but i think there is some lock somewhere:
As you can see, when device is connected first time we have 7 btw do we need to know what is event 0 and do we have to make use of it? ok, i found the problem register/deregister client is not enough, it is also required to install/uninstall host each time; im not sure if it is by design, so please comment Thanks |
@chegewara Having to uninstall to recover from a DCONN is a bit undesirable IMO (but I'm guessing the reason why that's working for you now is that the reinstall resets the underlying HCD port). Ideally, connections should be detectable again as soon as the last client of a previously DCONN'd device has closed that device. I'll see about adding either some new API to recover the port explicitly or make the recovery automatic. |
Thanks |
This commit fixes how the USB Host HCD handles sudden disconnections. Bugs: - HW channels remain active when the port suddenly disconnects, and previously the channel would be disabled by setting the disabled bit, then waiting for a disabled interrupt. However, ISOC channels do not generate the disabled interrupt when the port is invalid, thus leading to tasks getting indefinitely blocked in hcd_pipe_command(). Fix: On a sudden disconnection, forcibly treat all channels as halted even if their HCCHAR.ChEna bit is still set. We do a soft reset after a port error anyways, so the channels will eventually be reset. Closes #7505
This commit fixes how the USBH handling of a sudden device disconnection, more specifically handling of device gone. - Previously the USBH would only halt, flush, and dequeue the device's default EP, then send a device gone event to the Host Library layer. - Now the USBH will also halt and flush all non-default EPs, allowing all of the URBs to be dequeud. - Some internal object members are now protected by a mutex instead of a spinlock. Closes #7505
Im not sure if it is bug or just i am still missing some code.
Description:
Example to reproduce:
crash logs:
esp-idf branch: master
board: esp32S2 saola
The text was updated successfully, but these errors were encountered: