|
|
|
@ -196,26 +196,17 @@ class WifiManager: |
|
|
|
|
|
|
|
|
|
with self._conn_monitor.filter(rule, bufsize=SIGNAL_QUEUE_SIZE) as q: |
|
|
|
|
while not self._exit: |
|
|
|
|
# TODO: always run, and ensure callbacks don't block UI thread |
|
|
|
|
if not self._active: |
|
|
|
|
time.sleep(1) |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
# Block until a matching signal arrives |
|
|
|
|
try: |
|
|
|
|
msg = self._conn_monitor.recv_until_filtered(q, timeout=1) |
|
|
|
|
new_state, previous_state, change_reason = msg.body |
|
|
|
|
except TimeoutError: |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
new_state, previous_state, change_reason = msg.body |
|
|
|
|
|
|
|
|
|
# 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) |
|
|
|
|
print('hi') |
|
|
|
|
if self._need_auth is not None: |
|
|
|
|
print('wifi need auth', self._connecting_to_ssid) |
|
|
|
|
# self._callback_queue.append(lambda cb=self._need_auth, ssid=self._connecting_to_ssid: cb(ssid)) |
|
|
|
|
self._enqueue_callback(self._need_auth, self._connecting_to_ssid) |
|
|
|
|
self._connecting_to_ssid = "" |
|
|
|
|
|
|
|
|
@ -376,6 +367,10 @@ class WifiManager: |
|
|
|
|
cloudlog.warning("No WiFi device found") |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
if not self._active: |
|
|
|
|
cloudlog.debug("Skipping network update, not active") |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
# returns '/' if no active AP |
|
|
|
|
wifi_addr = DBusAddress(self._wifi_device, NM, interface=NM_WIRELESS_IFACE) |
|
|
|
|
active_ap_path = self._router_main.send_and_get_reply(Properties(wifi_addr).get('ActiveAccessPoint')).body[0][1] |
|
|
|
|