diff --git a/deploy/install_netwatch.sh b/deploy/install_netwatch.sh index 0b65221..32aed37 100755 --- a/deploy/install_netwatch.sh +++ b/deploy/install_netwatch.sh @@ -7,13 +7,15 @@ # already exist (see PLAN.md Phase 6). The optional "phone-hotspot" profile is # created through the Settings page. # -# Since Phase 23+: all WiFi traffic (hotspot AP, phone client, home client) -# runs on wlan1 (TP-Link T3U dongle). wlan0 (onboard) is disabled. +# Since 2026-08-12: the fast TP-Link T3U (wlan1) hosts the in-car AP +# ("Hotspot-local"), while the onboard BCM43438 (wlan0) carries the internet +# uplink (home-wifi / phone-hotspot). set -euo pipefail REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -WLAN=wlan1 # T3U dongle — change to wlan0 if reverting to onboard -WLAN_FB=wlan0 # onboard fallback +WLAN=wlan0 # onboard — internet uplink +WLAN_FB=wlan1 # T3U — uplink fallback +AP_IFACE=wlan1 # T3U — hosts the in-car AP sudo systemctl stop yaris-uplink-wait.service 2>/dev/null || true sudo systemctl stop yaris-netwatch.timer yaris-netwatch.service 2>/dev/null || true @@ -26,10 +28,11 @@ sudo install -m 644 "$REPO_DIR/deploy/yaris-hotspot-dns.conf" \ sudo install -m 755 "$REPO_DIR/deploy/90-yaris-uplink" \ /etc/NetworkManager/dispatcher.d/90-yaris-uplink -# Bind all connections to the T3U dongle (wlan1) +# Bind the internet uplink to the onboard radio (wlan0) sudo nmcli connection modify home-wifi connection.interface-name "$WLAN" -sudo nmcli connection modify Hotspot \ - connection.interface-name "$WLAN" \ +# The in-car AP lives on the fast T3U (wlan1) +sudo nmcli connection modify Hotspot-local \ + connection.interface-name "$AP_IFACE" \ ipv4.method shared \ ipv4.addresses 10.42.0.1/24 if nmcli connection show phone-hotspot >/dev/null 2>&1; then @@ -40,8 +43,8 @@ if nmcli connection show phone-hotspot >/dev/null 2>&1; then 802-11-wireless.mtu 1400 fi -# Create wlan0 fallback profiles (lower autoconnect-priority so wlan1 wins) -# home-wifi-fb: same SSID as home-wifi but on wlan0 +# Create wlan1 fallback profile (lower autoconnect-priority so wlan0 wins) +# home-wifi-fb: same SSID as home-wifi but on wlan1 (T3U) HOME_SSID=$(nmcli -g 802-11-wireless.ssid connection show home-wifi 2>/dev/null || true) HOME_PSK=$(sudo nmcli -g 802-11-wireless-security.psk connection show --show-secrets home-wifi 2>/dev/null || true) if [ -n "$HOME_SSID" ] && [ -n "$HOME_PSK" ]; then diff --git a/deploy/yaris_uplink.py b/deploy/yaris_uplink.py index bfe8e25..644dc6e 100644 --- a/deploy/yaris_uplink.py +++ b/deploy/yaris_uplink.py @@ -11,9 +11,13 @@ import uuid PHONE_CONNECTION = "phone-hotspot" HOME_CONNECTION = "home-wifi" -AP_CONNECTION = "Hotspot" -PRIMARY_INTERFACE = "wlan1" # TP-Link T3U dongle — preferred -FALLBACK_INTERFACE = "wlan0" # onboard — used if T3U is absent +AP_CONNECTION = "Hotspot-local" +# 2026-08-12 swap: the fast TP-Link T3U (wlan1) hosts the in-car AP so phones +# get 5GHz AC throughput; the weak onboard BCM43438 (wlan0) carries the +# internet uplink (home-wifi / phone-hotspot), which is background traffic. +AP_INTERFACE = "wlan1" +PRIMARY_INTERFACE = "wlan0" # onboard — internet uplink +FALLBACK_INTERFACE = "wlan1" # T3U — uplink fallback if onboard is absent STATUS_PATH = "/var/lib/yaris-obd/uplink-status.json" PHONE_KEYFILE = ( "/etc/NetworkManager/system-connections/" @@ -199,7 +203,7 @@ def write_status(action, error=None): def restore_fallback(): - """Try home-wifi on wlan1. wlan0 AP is permanent and never touched.""" + """Try home-wifi on the uplink interface. The AP on wlan1 is never touched.""" if activate(HOME_CONNECTION): write_status("connected_home") return True @@ -208,10 +212,10 @@ def restore_fallback(): def _ap_client_count(): - """Return number of stations connected to the AP on wlan0.""" + """Return number of stations connected to the AP on wlan1 (T3U).""" try: proc = subprocess.run( - ["iw", "dev", "wlan0", "station", "dump"], + ["iw", "dev", AP_INTERFACE, "station", "dump"], capture_output=True, text=True, timeout=5, ) return proc.stdout.count("Station ") @@ -220,7 +224,7 @@ def _ap_client_count(): def check_uplink(): - """Manage internet uplink on wlan1 only. wlan0 is a permanent AP, never touched.""" + """Manage internet uplink on wlan0 only. wlan1 AP is never touched.""" current = active_connection() phone_configured = connection_exists(PHONE_CONNECTION) @@ -240,7 +244,7 @@ def check_uplink(): return _connect_home_or_idle() if phone_configured: - # Only take down the phone hotspot if it's up — never touch the AP on wlan0 + # Only take down the phone hotspot if it's up — never touch the AP on wlan1 was_phone = current == PHONE_CONNECTION if was_phone: run_nmcli("connection", "down", PHONE_CONNECTION, check=False) @@ -281,7 +285,7 @@ def check_uplink(): def _connect_home_or_idle(): - """Try home-wifi on wlan1. wlan0 AP is never touched.""" + """Try home-wifi on the uplink interface. The AP on wlan1 is never touched.""" if activate(HOME_CONNECTION): write_status("connected_home") return True