diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-28 09:14:21 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-28 09:14:21 +0100 |
| commit | 96355cff09db091f5251ae851c46b8d1dd67f7a0 (patch) | |
| tree | 3db4518bc0fa1537d3d683fcfb412a986ccb4459 | |
| parent | 258fbbb987ed738c76c5c8d05dcc3cdfbbc06406 (diff) | |
| download | deck-it-96355cff09db091f5251ae851c46b8d1dd67f7a0.tar.gz deck-it-96355cff09db091f5251ae851c46b8d1dd67f7a0.zip | |
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 <noreply@anthropic.com>
| -rwxr-xr-x | deck-it | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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="" |
