Parse nmcli output into network list for Pi Zero W2 compatibility
(self, output)
| 1807 | return ssid |
| 1808 | except Exception as e: |
| 1809 | self.logger.debug(f"Could not resolve SSID of connection {name!r}: {e}") |
| 1810 | return None |
| 1811 | |
| 1812 | def _ssid_on_interface(self, iface): |
| 1813 | """The SSID the radio is actually associated to, straight from the kernel.""" |
| 1814 | if not iface: |
| 1815 | return None |
| 1816 | try: |
| 1817 | result = subprocess.run(['iw', 'dev', iface, 'link'], |
| 1818 | capture_output=True, text=True, timeout=5) |
| 1819 | if result.returncode == 0: |
| 1820 | for line in result.stdout.splitlines(): |
| 1821 | line = line.strip() |
| 1822 | if line.startswith('SSID:'): |
| 1823 | ssid = line[len('SSID:'):].strip() |
| 1824 | if ssid: |
| 1825 | return ssid |
| 1826 | except FileNotFoundError: |
| 1827 | pass |
| 1828 | except Exception as e: |
| 1829 | self.logger.debug(f"iw link failed on {iface}: {e}") |
| 1830 | return None |
| 1831 | |
| 1832 | def get_current_ssid(self): |
| 1833 | """Get the current connected SSID — the network's name, never a profile label.""" |
| 1834 | try: |
| 1835 | client_iface = self._client_wifi_interface() |
| 1836 | |
| 1837 | # Method 1: the connection active on the CLIENT radio — the dongle |
| 1838 | # when one is fitted, since the built-in may be hosting the AP and |