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:
parent
27c83a21a1
commit
3945f24f46
1 changed files with 6 additions and 2 deletions
|
|
@ -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"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue