From d5f6d6ee72c8fe4e2b2b8a3f0a40f91736489197 Mon Sep 17 00:00:00 2001 From: dirwin31 <83434411+dirwin31@users.noreply.github.com> Date: Sun, 1 Nov 2026 13:55:26 -0800 Subject: [PATCH] Only wait on a Wi-Fi interface NetworkManager reports as unmanaged or unavailable The first version waited on any state below disconnected, which also caught the unknown state and broke the lease tests. Wait on states 10 and 20 only. --- openpilot/starpilot/system/starport/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpilot/starpilot/system/starport/network.py b/openpilot/starpilot/system/starport/network.py index 61858ec44a..1611016419 100644 --- a/openpilot/starpilot/system/starport/network.py +++ b/openpilot/starpilot/system/starport/network.py @@ -39,6 +39,7 @@ NM_WIRELESS_IFACE = "org.freedesktop.NetworkManager.Device.Wireless" NM_AP_IFACE = "org.freedesktop.NetworkManager.AccessPoint" DEVICE_TYPE_WIFI = 2 DEVICE_STATE_DISCONNECTED = 30 +DEVICE_STATES_NOT_MANAGED = (10, 20) # NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_UNAVAILABLE DEVICE_READY_TIMEOUT_S = 5.0 # A shared interface can be briefly unmanaged (for example while the Wi-Fi mode is being switched). Bugsink showed 19 joins # refused with "device is strictly unmanaged"; waiting a few seconds turns a transient state into a normal join, and a @@ -325,7 +326,7 @@ class NetworkLease: """Give NetworkManager a few seconds to manage the shared interface before joining on it.""" deadline = time.monotonic() + timeout waited = False - while (state := self._get(self.device_path, NM_DEVICE_IFACE, "State")) < DEVICE_STATE_DISCONNECTED: + while (state := self._get(self.device_path, NM_DEVICE_IFACE, "State")) in DEVICE_STATES_NOT_MANAGED: if cancelled(): raise NetworkError("cancelled") if time.monotonic() >= deadline: