Repository navigation
Fixes Crash Loop When Multiple USB Devices - #5
Merged
Merged
Conversation
find_port() raises AmbiguousPortError when it sees several usbmodem ports,
and run_forever called it outside any handler. Under launchd's KeepAlive
that's a crash-loop: the helper exits, restarts ten seconds later, finds
the same ports, and exits again, until someone unplugs a board. I hit this
with a second ESP32-S3 board on the same hub; the log showed 13 crashes
before I unplugged it.
Treat it like any other absent board instead: keep looking every second,
and connect as soon as there's one. Say why once per episode rather than
once per retry, in the log and in the Checkup's Device row ("More than one
board is plugged in"), so the fix is obvious.
This doesn't pick the right board when there are several; it just stops
the helper from dying while it waits for someone to unplug one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Another good catch; I hadn't tested fully with multiple devices, and it's good to be more resilient there. Thanks for this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the helper starts with more than one
/dev/cu.usbmodem*port present, an exception is raised and the helper exits. Under launchd'sKeepAlive, we get stuck in a crash loop: the helper restarts, finds the same ports and exits again, until someone unplugs a board.I ran into this with a second ESP32-S3 board plugged in alongside my dashtouch.
Solution
Treat several boards like a missing board: keep checking every second, instead of crashing, and inform the user in the UI. This doesn't choose the right board; it keeps the helper running and tells the user what to do. It's independent of #4, which fixes the same situation during flashing.