[IMP] hw_drivers: PrinterDriver get hotspot name for status ticket

When the IoT Box is not connected to the IoT Box, a hotspot would be
created to configure it. The name of this hotspot is printed on a
status receipt if a printer is connected. Previously, this ticket only
showed the default name of the hotspot, but this name will be different
if the user renamed the Box. We then read the name of the hotspot from
the config.

closes odoo/odoo#33095

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Antoine Prieels
2019-08-08 11:53:37 +00:00
parent 1e5ed54866
commit 7cb9518857
+4 -1
View File
@@ -247,7 +247,10 @@ class PrinterDriver(Driver):
hosting_ap = os.system('pgrep hostapd') == 0
ssid = subprocess.check_output('iwconfig 2>&1 | grep \'ESSID:"\' | sed \'s/.*"\\(.*\\)"/\\1/\'', shell=True).decode('utf-8').rstrip()
if hosting_ap:
wlan = 'Wireless network:\nIoTBox\n\n'
with open('/root_bypass_ramdisks/etc/hostapd/hostapd.conf') as config_file:
lines = config_file.readlines()
ssid = lines[1].split("=")[1].replace("\n", "")
wlan = 'Wireless network:\n%s\n\n' % ssid
elif ssid:
wlan = 'Wireless network:\n%s\n\n' % ssid