From 9bb3ac9df46a8ff69787853800b663aa9f8e3504 Mon Sep 17 00:00:00 2001 From: mrambossek Date: Fri, 31 Jul 2026 22:26:09 +0200 Subject: [PATCH] tools: version the beacon PC-connector; confirm Shizuku-toggle recovery connect.sh polls the fmr beacon map and keeps `adb connect` current for every device, now handling offline/stale entries and port changes (disconnect+reconnect). Verified end to end: after Shizuku start + a wireless-debugging toggle, the tablet's port rotated 38309->46667, the beacon caught it, the connector reconnected, and Shizuku kept running as an independent shell(2000) process. Co-Authored-By: Claude Opus 5 --- tools/adb-beacon/connect.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/adb-beacon/connect.sh diff --git a/tools/adb-beacon/connect.sh b/tools/adb-beacon/connect.sh new file mode 100644 index 0000000..6059d3c --- /dev/null +++ b/tools/adb-beacon/connect.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Keeps `adb connect` current for every device in the fmr beacon map. +# Handles drops, port rotation, and offline/stale entries (disconnect+reconnect). +BEACON="http://89.185.109.150:443/beacon" +while true; do + curl -s --max-time 5 "$BEACON" 2>/dev/null | python -c ' +import json,sys,time +try: d=json.load(sys.stdin) +except: d={} +now=int(time.time()) +for dev,v in (d or {}).items(): + if now-v.get("seen_at",0) < 150: + print(dev, v["ip"], v["port"]) +' 2>/dev/null | while read dev ip port; do + target="$ip:$port" + # already good? + if adb devices | grep -q "^$target[[:space:]]*device$"; then continue; fi + # clear any stale/offline entries for this IP, then connect the current port + adb devices | awk -v ip="$ip" '$1 ~ ip {print $1}' | while read stale; do adb disconnect "$stale" >/dev/null 2>&1; done + r=$(adb connect "$target" 2>&1) + echo "$(date +%H:%M:%S) [$dev] $target -> $r" + done + sleep 8 +done