-
Notifications
You must be signed in to change notification settings - Fork 33
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
Restart usbdaemon after USB connection closes #102
Comments
@kevinmehall can you give me some guidance on how to implement this? |
It doesn't look like this was ever fully implemented. If you want a quick and dirty solution, send Line 732 in f88e096
Looking at the code, the basics of a more robust out-of-band solution were implemented on both ends, but not in the middle: In the firmware, t2-firmware/firmware/usbpipe.c Line 16 in f88e096
The SPI bridge currently contains a mechanism to indicate to the coprocessor whether or not the domain socket is opened by a process running on the SoC, which is used to enable and disable the module ports. We need the opposite of that, a way to indicate to the SoC that the connection should be closed. We'll use the top 4 bits of the flags byte (second byte of the header transfer) to indicate the open/close status of each of the 4 channels, just like are currently used in the other direction. All it has to do is set the bit and raise the IRQ pin to indicate to the SPI daemon that something changed. Add to bridge.c and headers in firmware.h:
Call In the SPI daemon, those enable bits are received as the top 4 bits of usbexecd aborts when the domain socket is closed: Line 710 in f88e096
|
@kevinmehall thanks for this super in-depth explanation of how it should work. It's very clear how each of the pieces function together. I started implementing your suggestion but it looks like |
Remove the Line 436 in 1becac4
Releasing the interface should also be calling that function with |
I guess it's time I go find a debugger :) What should the |
@kevinmehall it looks like none of debuggers survived the transition with the exception of a handful of questionable Seggers. Do you have any spares I can borrow? I'll also need to find and solder a JTAG header. |
|
Fixed by #103 (when it gets merged). |
[Finally got a chance to dig back into this] I have the code in a state where it is reliably opening and closing channels in the SPI Daemon. However, there is an unexpected issue: OpenWRT seems to take 2+ seconds to restart the USB Daemon after it's killed. If the user tries to run another process in those few seconds, something gets confused and doesn't properly close. I'm looking into any documentation for restarting it faster (maybe a shell script... ew) or potentially launching it from the SPI Daemon if it receives data on the USB channel and doesn't detect the process. |
We could make successive CLI commands more likely to succeed if we restarted the USBDaemon after a connection closes. That way any unclosed process or broken state in the daemon would be resolved.
According to @kevinmehall we used to have this functionality but we lost it at some point.
The text was updated successfully, but these errors were encountered: