From 2e21deeae83384e35cbacbf55e3624425dc5ddd6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 12 Feb 2026 20:48:34 -0800 Subject: [PATCH] WifiUi: fix up wrong password dialog (#37195) * debug why so slow * forget after * i'm not sure why this is a thing * better forget connecting reset * ???? * has lag * fix * clean up * should be fine --- .../ui/mici/layouts/settings/network/wifi_ui.py | 15 +++++++++++---- system/ui/lib/wifi_manager.py | 10 +++++----- system/ui/widgets/network.py | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py b/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py index 2b5c6be6e..5c9616524 100644 --- a/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py +++ b/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py @@ -445,14 +445,21 @@ class WifiUIMici(BigMultiOptionDialog): hint = "wrong password..." if incorrect_password else "enter password..." dlg = BigInputDialog(hint, "", minimum_length=8, confirm_callback=lambda _password: self._connect_with_password(ssid, _password)) - # go back to the manage network page - gui_app.set_modal_overlay(dlg, self._open_network_manage_page) + + def on_close(result=None): + gui_app.set_modal_overlay_tick(None) + self._open_network_manage_page(result) + + # Process wifi callbacks while the keyboard is shown so forgotten clears connecting state + gui_app.set_modal_overlay_tick(self._wifi_manager.process_callbacks) + gui_app.set_modal_overlay(dlg, on_close) def _on_activated(self): self._connecting = None - def _on_forgotten(self): - self._connecting = None + def _on_forgotten(self, ssid): + if self._connecting == ssid: + self._connecting = None def _on_disconnected(self): self._connecting = None diff --git a/system/ui/lib/wifi_manager.py b/system/ui/lib/wifi_manager.py index b2f077422..72373ecbe 100644 --- a/system/ui/lib/wifi_manager.py +++ b/system/ui/lib/wifi_manager.py @@ -183,7 +183,7 @@ class WifiManager: # Callbacks self._need_auth: list[Callable[[str], None]] = [] self._activated: list[Callable[[], None]] = [] - self._forgotten: list[Callable[[], None]] = [] + self._forgotten: list[Callable[[str], None]] = [] self._networks_updated: list[Callable[[list[Network]], None]] = [] self._disconnected: list[Callable[[], None]] = [] @@ -211,7 +211,7 @@ class WifiManager: def add_callbacks(self, need_auth: Callable[[str], None] | None = None, activated: Callable[[], None] | None = None, - forgotten: Callable[[], None] | None = None, + forgotten: Callable[[str], None] | None = None, networks_updated: Callable[[list[Network]], None] | None = None, disconnected: Callable[[], None] | None = None): if need_auth is not None: @@ -316,8 +316,8 @@ class WifiManager: # BAD PASSWORD if new_state == NMDeviceState.NEED_AUTH and change_reason == NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT and len(self._connecting_to_ssid): - self.forget_connection(self._connecting_to_ssid, block=True) self._enqueue_callbacks(self._need_auth, self._connecting_to_ssid) + self.forget_connection(self._connecting_to_ssid, block=True) self._connecting_to_ssid = "" elif new_state == NMDeviceState.ACTIVATED: @@ -327,8 +327,8 @@ class WifiManager: self._connecting_to_ssid = "" elif new_state == NMDeviceState.DISCONNECTED and change_reason != NM_DEVICE_STATE_REASON_NEW_ACTIVATION: + self._enqueue_callbacks(self._forgotten, self._connecting_to_ssid) self._connecting_to_ssid = "" - self._enqueue_callbacks(self._forgotten) def _network_scanner(self): while not self._exit: @@ -484,7 +484,7 @@ class WifiManager: if len(self._forgotten): self._update_networks() - self._enqueue_callbacks(self._forgotten) + self._enqueue_callbacks(self._forgotten, ssid) if block: worker() diff --git a/system/ui/widgets/network.py b/system/ui/widgets/network.py index 8f5168958..9de44c585 100644 --- a/system/ui/widgets/network.py +++ b/system/ui/widgets/network.py @@ -463,7 +463,7 @@ class WifiManagerUI(Widget): if self.state == UIState.CONNECTING: self.state = UIState.IDLE - def _on_forgotten(self): + def _on_forgotten(self, _): if self.state == UIState.FORGETTING: self.state = UIState.IDLE