mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-19 22:23:44 +08:00
ui: don't spam logs when NetworkManager is not available (#38504)
This commit is contained in:
@@ -515,8 +515,11 @@ class WifiManager:
|
||||
def _get_adapter(self, adapter_type: int) -> str | None:
|
||||
# Return the first NetworkManager device path matching adapter_type
|
||||
try:
|
||||
device_paths = self._router_main.send_and_get_reply(new_method_call(self._nm, 'GetDevices')).body[0]
|
||||
for device_path in device_paths:
|
||||
reply = self._router_main.send_and_get_reply(new_method_call(self._nm, 'GetDevices'))
|
||||
if reply.header.message_type == MessageType.error:
|
||||
# NetworkManager is not available, body holds an error string instead of device paths
|
||||
return None
|
||||
for device_path in reply.body[0]:
|
||||
dev_addr = DBusAddress(device_path, bus_name=NM, interface=NM_DEVICE_IFACE)
|
||||
dev_type = self._router_main.send_and_get_reply(Properties(dev_addr).get('DeviceType')).body[0][1]
|
||||
if dev_type == adapter_type:
|
||||
|
||||
Reference in New Issue
Block a user