From 96355cff09db091f5251ae851c46b8d1dd67f7a0 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 28 Nov 2026 09:14:21 +0100 Subject: fix(launcher): watch-usb starts the tablet, and again after a resume watch-usb called "deck-it start", which is not a command: it printed the usage and exited, so a plug-in never started anything. It now runs the USB start. After a resume the serial is unchanged but adb has lost the reverses; the watcher now starts again when the dashboard port is no longer reversed and the previous start has finished. Co-Authored-By: Claude Opus 5.5 --- deck-it | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/deck-it b/deck-it index 5e77ac7..c14a1aa 100755 --- a/deck-it +++ b/deck-it @@ -186,13 +186,15 @@ setup-display) ;; watch-usb) # A user-space watcher, so it can reach the session: udev RUN= cannot. - # Start on plug-in, tear down on unplug. - known="" + # Start on plug-in, tear down on unplug. After a resume the serial is the + # same but adb lost the reverses: start again once the last start is done. + known="" pid="" while sleep 5; do now=$(timeout 4 adb -d get-serialno 2>/dev/null) - if [[ -n "$now" && "$now" != "$known" ]]; then - "$SELF" start >/dev/null 2>&1 & - known=$now + if [[ -n "$now" && ( "$now" != "$known" || ! -e /proc/${pid:-0} ) ]] && + ! { [[ "$now" == "$known" ]] && timeout 6 adb -s "$now" reverse --list 2>/dev/null | grep -q "tcp:$PORT "; }; then + "$SELF" >/dev/null 2>&1 & + known=$now pid=$! elif [[ -z "$now" && -n "$known" ]]; then teardown known="" -- cgit v1.2.3