mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-10 07:22:07 +08:00
Fix unable to display ip address issue
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user