fix: USB tether monitor — also trigger on operstate 'unknown'

Android USB tethering (NCM/RNDIS) reports operstate='unknown' not 'up'.
Now triggers connect on 'up' OR 'unknown', disconnects only on 'down'/'missing'.
This commit is contained in:
kayos 2026-03-25 14:21:22 -07:00
parent 27c83a21a1
commit 3945f24f46

View file

@ -1933,14 +1933,18 @@ def usb_tether_monitor():
last_state = state
continue
if state == "up" and last_state != "up":
# 'up' or 'unknown' = active (Android USB tethering reports 'unknown' not 'up')
is_active = state in ("up", "unknown")
was_active_state = last_state in ("up", "unknown")
if is_active and not was_active_state:
# Carrier just arrived
with _usb_tether_lock:
already_active = _usb_tether_state["active"]
if not already_active:
_start_usb_tether()
elif state != "up" and last_state == "up":
elif not is_active and was_active_state:
# Carrier just dropped
with _usb_tether_lock:
was_active = _usb_tether_state["active"]