From b4b36432015318cb13aae79629de49ec11f51c4b Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Wed, 12 Aug 2026 16:17:21 -0400 Subject: [PATCH] =?UTF-8?q?net:=20app=5Fnetwork.py=20reflects=20WiFi=20swa?= =?UTF-8?q?p=20=E2=80=94=20uplink=20on=20wlan0,=20AP=20on=20wlan1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/app_network.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/app_network.py b/modules/app_network.py index 6d2522c..29cc0be 100644 --- a/modules/app_network.py +++ b/modules/app_network.py @@ -9,8 +9,11 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) INSTALLED_HELPER = "/usr/local/bin/yaris-uplink" REPO_HELPER = os.path.join(BASE_DIR, "deploy", "yaris_uplink.py") PHONE_CONNECTION = "phone-hotspot" -PRIMARY_INTERFACE = "wlan1" -FALLBACK_INTERFACE = "wlan0" +# 2026-08-12 swap: onboard (wlan0) carries the internet uplink; the fast +# T3U (wlan1) hosts the in-car AP. +PRIMARY_INTERFACE = "wlan0" +FALLBACK_INTERFACE = "wlan1" +AP_INTERFACE = "wlan1" STATUS_PATH = "/var/lib/yaris-obd/uplink-status.json" @@ -135,23 +138,23 @@ def get_status(): phone_ssid = _phone_ssid() internet_reachable = connectivity == "4 (full)" - # Check wlan0 AP state (permanent hotspot) + # Check AP state on wlan1 (T3U) ap_active = False ap_ip = "" try: ap_active = subprocess.run( - ["nmcli", "-g", "GENERAL.CONNECTION", "device", "show", "wlan0"], + ["nmcli", "-g", "GENERAL.CONNECTION", "device", "show", AP_INTERFACE], 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"], + ["nmcli", "-g", "IP4.ADDRESS", "device", "show", AP_INTERFACE], 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 + # Mode reflects the uplink interface state, not the AP uplink_mode = ( "phone" if active == PHONE_CONNECTION else "wifi" if active