fix(phase26): dual-radio — wlan0 permanent AP, wlan1 internet uplink (BUG-01)
This commit is contained in:
+27
-9
@@ -134,17 +134,35 @@ def get_status():
|
||||
connectivity = values[2]
|
||||
phone_ssid = _phone_ssid()
|
||||
internet_reachable = connectivity == "4 (full)"
|
||||
|
||||
# Check wlan0 AP state (permanent hotspot)
|
||||
ap_active = False
|
||||
ap_ip = ""
|
||||
try:
|
||||
ap_active = subprocess.run(
|
||||
["nmcli", "-g", "GENERAL.CONNECTION", "device", "show", "wlan0"],
|
||||
capture_output=True, text=True, timeout=5,
|
||||
).stdout.strip() == "Hotspot-local"
|
||||
if ap_active:
|
||||
ap_ip = subprocess.run(
|
||||
["nmcli", "-g", "IP4.ADDRESS", "device", "show", "wlan0"],
|
||||
capture_output=True, text=True, timeout=5,
|
||||
).stdout.strip().split("/", 1)[0]
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
|
||||
# Mode reflects wlan1 uplink state, not wlan0 AP
|
||||
uplink_mode = (
|
||||
"phone" if active == PHONE_CONNECTION
|
||||
else "wifi" if active
|
||||
else "disconnected"
|
||||
)
|
||||
|
||||
return {
|
||||
"active_connection": active,
|
||||
"mode": (
|
||||
"phone"
|
||||
if active == PHONE_CONNECTION
|
||||
else "local_hotspot"
|
||||
if active == "Hotspot"
|
||||
else "wifi"
|
||||
if active
|
||||
else "disconnected"
|
||||
),
|
||||
"mode": uplink_mode,
|
||||
"ap_active": ap_active,
|
||||
"ap_ip": ap_ip,
|
||||
"state": values[1],
|
||||
"internet_reachable": internet_reachable,
|
||||
"connectivity": connectivity,
|
||||
|
||||
Reference in New Issue
Block a user