diff options
Diffstat (limited to 'addons/hw_drivers/tools/helpers.py')
| -rw-r--r-- | addons/hw_drivers/tools/helpers.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/hw_drivers/tools/helpers.py b/addons/hw_drivers/tools/helpers.py index f59de214d9d..0be09086e4d 100644 --- a/addons/hw_drivers/tools/helpers.py +++ b/addons/hw_drivers/tools/helpers.py @@ -129,6 +129,9 @@ def get_mac_address(): return netifaces.ifaddresses('wlan0')[netifaces.AF_LINK][0]['addr'] def get_ssid(): + ap = subprocess.call(['systemctl', 'is-active', 'hostapd']) # if service is active return 0 else inactive + if not ap: + return subprocess.check_output(['grep', '-oP', '(?<=ssid=).*', '/etc/hostapd/hostapd.conf']).decode('utf-8').rstrip() process_iwconfig = subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) process_grep = subprocess.Popen(['grep', 'ESSID:"'], stdin=process_iwconfig.stdout, stdout=subprocess.PIPE) return subprocess.check_output(['sed', 's/.*"\\(.*\\)"/\\1/'], stdin=process_grep.stdout).decode('utf-8').rstrip() |
