flash.sh: auto-detect the Cardputer serial port

The port number changes when the device re-enumerates (ttyACM0 -> ttyACM1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-02 09:05:15 +02:00
co-authored by Claude Opus 5.5
parent 4c0be8925d
commit b293197ace
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
# Flash the firmware over USB, then open the serial monitor.
# Usage: scripts/flash.sh [/dev/ttyACM0]
# Usage: scripts/flash.sh [port] (default: the first Espressif device found)
set -euo pipefail
PORT="${1:-/dev/ttyACM0}"
PORT="${1:-$(readlink -f /dev/serial/by-id/*Espressif* 2>/dev/null | head -1)}"
[ -n "$PORT" ] || { echo "No Cardputer found on USB (is it plugged in / attached to the VM?)" >&2; exit 1; }
source "$(dirname "$0")/_docker.sh"
DOCKER_EXTRA=(--device "$PORT" --group-add "$(stat -c %g "$PORT")" -it)