Skip to content

Fixes Crash Loop When Multiple USB Devices - #5

Merged
anildash merged 1 commit into
anildash:mainfrom
vanev:fix-multiple-boards-crash
Oct 3, 2026
Merged

anildash merged 1 commit into
anildash:mainfrom
vanev:fix-multiple-boards-crash

Conversation

@vanev

@vanev vanev commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Problem

When the helper starts with more than one /dev/cu.usbmodem* port present, an exception is raised and the helper exits. Under launchd's KeepAlive, 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.

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>
@anildash

anildash commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Another good catch; I hadn't tested fully with multiple devices, and it's good to be more resilient there. Thanks for this.

@anildash
anildash merged commit 6b54306 into anildash:main Oct 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants