Compare commits

...

3 commits

Author SHA1 Message Date
45357ae4d2 Ignore local status note
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 21:15:12 +01:00
1eb5e17ee7 Poll up to 45s for the tether after Connect instead of a fixed 4s sleep
First plug-in after a reboot takes iOS 20-30s to bring the interface up
and complete DHCP; the 4s sleep reported false 'enable hotspot' advice
when the hotspot was already on. Also broadens the failure advice
(unlock once after phone restart, replug as last resort).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:54:24 +01:00
7356dce619 Ignore local work log
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:26:54 +01:00
2 changed files with 28 additions and 6 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
CLAUDE.local.md
STATUS.md

View file

@ -71,6 +71,21 @@ net_test() {
curl -sf --interface "$iface" --max-time 5 -o /dev/null https://www.google.com
}
# Poll until the tether has an IP and working internet, or time out (arg:
# seconds). First plug-in after a reboot can take 20-30s before iOS brings
# the interface up and DHCP completes — a fixed short sleep reports false
# "enable hotspot" advice.
tether_wait() {
local deadline=$(( SECONDS + ${1:-45} )) iface
while (( SECONDS < deadline )); do
if iface=$(tether_iface) && [[ -n $(tether_ip "$iface") ]] && net_test "$iface"; then
return 0
fi
sleep 2
done
return 1
}
# usbmuxd drops devices that were plugged in before it started
# ("device unconfigured") — a restart rescans the bus.
revive_usbmuxd() {
@ -382,14 +397,19 @@ tui_connect() {
ok "Paired with $(phone_name)"
fi
# Give networkd a moment to DHCP the freshly-authorised interface.
# Poll for the connection — first plug-in after a reboot can take 20-30s
# (functions exported so the gum spin child shell can run them).
local iface=""
gum spin --title "Bringing the connection up…" -- sleep 4 || true
if iface=$(tether_iface) && [[ -n $(tether_ip "$iface") ]] && net_test "$iface"; then
ok "Connected — internet available through the phone ($iface)"
export -f tether_wait tether_iface tether_ip net_test
if gum spin --title "Bringing the connection up… (can take ~30s after a reboot)" -- \
bash -c 'tether_wait 45'; then
iface=$(tether_iface || true)
ok "Connected — internet available through the phone (${iface:-tether})"
else
warn "Paired, but no connection yet. On the phone enable:"
say " Settings → Personal Hotspot → Allow Others to Join: ON"
warn "Paired, but the phone hasn't offered a connection yet. Check:"
say " • Settings → Personal Hotspot → Allow Others to Join: ON"
say " • Unlock the phone once (needed after a phone restart)"
say " • Still nothing? Unplug and replug the cable, then Connect again."
fi
pause
}