Retry Android shortcut connections after a quick relaunch

This commit is contained in:
Kurt Himebauch committed 2026-12-05 22:10:10 -05:00
1 parent 788920ff89
commit a051cd5fa6
1 file changed
+6 -3
@@ -33,8 +33,11 @@ flock -n 9 || fail "Close the running Android app shortcut first."
adb start-server 9>&- || fail "Could not start the Android connection."
trap 'adb kill-server 9>&- >/dev/null 2>&1 || true' EXIT
trap 'exit 0' INT TERM HUP
timeout 8 adb connect "$serial" 9>&- || true
[ "$(timeout 5 adb -s "$serial" get-state 9>&- 2>/dev/null || true)" = device ] ||
connected() {
timeout 8 adb connect "$serial" 9>&- >/dev/null 2>&1 || true
[ "$(timeout 3 adb -s "$serial" get-state 9>&- 2>/dev/null || true)" = device ]
}
connected || connected ||
fail "Android is disconnected. Turn on Wireless debugging, then restart Steam."
export SDL_VIDEODRIVER=x11
@@ -42,4 +45,4 @@ export SDL_VIDEODRIVER=x11
scrcpy --serial "$serial" --new-display=1280x720/240 --start-app="$package" \
--window-title="Android app" --no-vd-system-decorations --no-clipboard-autosync \
--mouse-bind=----:---- --gamepad=uhid --no-audio --max-fps=60 9>&- ||
fail "The Android app window closed unexpectedly. Check Wireless debugging and try again."
fail "The Android app window closed unexpectedly. Try launching it again."