feat: FEAT-14 dual T3U — wlan2 uplink, wlan1 AP, onboard wlan0 fallback
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
wlan0|wlan1) ;;
|
||||
wlan0|wlan1|wlan2) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
|
||||
+11
-11
@@ -7,15 +7,15 @@
|
||||
# already exist (see PLAN.md Phase 6). The optional "phone-hotspot" profile is
|
||||
# created through the Settings page.
|
||||
#
|
||||
# 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).
|
||||
# Since 2026-08-14 (FEAT-14): dual T3U — wlan1 (T3U #1) hosts the in-car AP
|
||||
# ("Hotspot-local"), and a second T3U (wlan2) carries the internet uplink
|
||||
# (home-wifi / phone-hotspot); the onboard BCM43438 (wlan0) is the fallback.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
WLAN=wlan0 # onboard — internet uplink
|
||||
WLAN_FB=wlan1 # T3U — uplink fallback
|
||||
AP_IFACE=wlan1 # T3U — hosts the in-car AP
|
||||
WLAN=wlan2 # T3U #2 — internet uplink
|
||||
WLAN_FB=wlan0 # onboard BCM43438 — uplink fallback
|
||||
AP_IFACE=wlan1 # T3U #1 — 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
|
||||
@@ -28,9 +28,9 @@ 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 the internet uplink to the onboard radio (wlan0)
|
||||
# Bind the internet uplink to the second T3U (wlan2)
|
||||
sudo nmcli connection modify home-wifi connection.interface-name "$WLAN"
|
||||
# The in-car AP lives on the fast T3U (wlan1), forced to 5GHz
|
||||
# The in-car AP lives on T3U #1 (wlan1), forced to 5GHz
|
||||
sudo nmcli connection modify Hotspot-local \
|
||||
connection.interface-name "$AP_IFACE" \
|
||||
802-11-wireless.band a \
|
||||
@@ -44,8 +44,8 @@ if nmcli connection show phone-hotspot >/dev/null 2>&1; then
|
||||
802-11-wireless.mtu 1400
|
||||
fi
|
||||
|
||||
# Create wlan1 fallback profile (lower autoconnect-priority so wlan0 wins)
|
||||
# home-wifi-fb: same SSID as home-wifi but on wlan1 (T3U)
|
||||
# Create wlan0 fallback profile (lower autoconnect-priority so wlan2 wins)
|
||||
# home-wifi-fb: same SSID as home-wifi but on wlan0 (onboard)
|
||||
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
|
||||
@@ -62,7 +62,7 @@ if [ -n "$HOME_SSID" ] && [ -n "$HOME_PSK" ]; then
|
||||
echo "Created home-wifi-fb fallback on $WLAN_FB"
|
||||
fi
|
||||
|
||||
# Re-enable wlan0 as a managed (but low-priority) fallback
|
||||
# Re-enable wlan0 (onboard) as a managed low-priority fallback
|
||||
sudo nmcli device set "$WLAN_FB" managed yes 2>/dev/null || true
|
||||
|
||||
sudo cp "$REPO_DIR/deploy/yaris-netwatch.service" /etc/systemd/system/yaris-netwatch.service
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ cd /home/yaris/app/yaris-obd
|
||||
|
||||
# REQUIRED before netwatch install:
|
||||
# Create/update NetworkManager profiles named exactly:
|
||||
# - home-wifi (client WiFi → wlan0, the internet uplink)
|
||||
# - home-wifi (client WiFi → wlan2, the internet uplink)
|
||||
# - Hotspot-local (local AP, shared at 10.42.0.1/24, on wlan1)
|
||||
# See section 4 below for exact nmcli commands.
|
||||
|
||||
@@ -42,10 +42,10 @@ curl -I http://127.0.0.1/
|
||||
|
||||
## TP-Link Archer T3U (RTL8812BU) driver
|
||||
|
||||
This project expects the T3U USB adapter as `wlan1` for the in-car AP (5GHz)
|
||||
and the onboard radio as `wlan0` for the internet uplink (home WiFi + phone
|
||||
hotspot). On a fresh Pi, install the RTL8812BU DKMS driver before configuring
|
||||
WiFi profiles:
|
||||
This project expects two T3U USB adapters — `wlan1` for the in-car AP (5GHz)
|
||||
and `wlan2` for the internet uplink (home WiFi + phone hotspot); the onboard
|
||||
`wlan0` is a fallback. On a fresh Pi, install the RTL8812BU DKMS driver before
|
||||
configuring WiFi profiles:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
|
||||
@@ -12,12 +12,12 @@ import uuid
|
||||
PHONE_CONNECTION = "phone-hotspot"
|
||||
HOME_CONNECTION = "home-wifi"
|
||||
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.
|
||||
# 2026-08-14 (FEAT-14): dual T3U — wlan1 (T3U #1) hosts the in-car AP so phones
|
||||
# get 5GHz AC throughput; a second T3U (wlan2) carries the internet uplink
|
||||
# (home-wifi / phone-hotspot); the onboard BCM43438 (wlan0) is only a fallback.
|
||||
AP_INTERFACE = "wlan1"
|
||||
PRIMARY_INTERFACE = "wlan0" # onboard — internet uplink
|
||||
FALLBACK_INTERFACE = "wlan1" # T3U — uplink fallback if onboard is absent
|
||||
PRIMARY_INTERFACE = "wlan2" # T3U #2 — internet uplink
|
||||
FALLBACK_INTERFACE = "wlan0" # onboard BCM43438 — fallback if T3U #2 is absent
|
||||
STATUS_PATH = "/var/lib/yaris-obd/uplink-status.json"
|
||||
PHONE_KEYFILE = (
|
||||
"/etc/NetworkManager/system-connections/"
|
||||
@@ -224,7 +224,7 @@ def _ap_client_count():
|
||||
|
||||
|
||||
def check_uplink():
|
||||
"""Manage internet uplink on wlan0 only. wlan1 AP is never touched."""
|
||||
"""Manage internet uplink on the uplink interface only. wlan1 AP is never touched."""
|
||||
current = active_connection()
|
||||
phone_configured = connection_exists(PHONE_CONNECTION)
|
||||
|
||||
@@ -275,7 +275,7 @@ def check_uplink():
|
||||
return True
|
||||
return _connect_home_or_idle()
|
||||
|
||||
# Phone not configured. Home wifi is the only uplink on wlan1.
|
||||
# Phone not configured. Home wifi is the only uplink.
|
||||
if current == HOME_CONNECTION:
|
||||
write_status("home_connected_no_phone")
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user