Fix unable to display ip address issue

This commit is contained in:
dragonpilot
2019-10-10 14:09:09 +10:00
parent 7b8bd9e3ff
commit 6c1fa5dc3a
+2 -9
View File
@@ -193,16 +193,9 @@ def thermald_thread():
ts = sec_since_boot()
if ts - ts_last_ip > 10.:
try:
result = subprocess.check_output(["service", "call", "connectivity", "2"]).strip().split("\n")
except subprocess.CalledProcessError:
return False
data = ''.join(''.join(w.decode("hex")[::-1] for w in l[14:49].split()) for l in result[1:])
if "\x00".join("WIFI") in data:
result = subprocess.check_output(["ifconfig", "wlan0"])
result = subprocess.check_output(["ifconfig", "wlan0"], encoding='utf8') # pylint: disable=unexpected-keyword-arg
ip_addr = re.findall(r"inet addr:((\d+\.){3}\d+)", result)[0][0]
else:
except:
ip_addr = 'N/A'
ts_last_ip = ts
msg.thermal.ipAddr = ip_addr