[scan] wifi
This commit is contained in:
parent
0e1e3f442d
commit
1323e45dbd
|
@ -160,7 +160,6 @@ def init_networkmanager_file():
|
||||||
def check_wifi_connection():
|
def check_wifi_connection():
|
||||||
cmd = "nmcli dev status"
|
cmd = "nmcli dev status"
|
||||||
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
|
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
|
||||||
time.sleep(1) # 等待1秒,确保nmcli命令执行完成
|
|
||||||
output = result.stdout.strip()
|
output = result.stdout.strip()
|
||||||
lines = output.split("\n")[1:] # Skip the header line
|
lines = output.split("\n")[1:] # Skip the header line
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
@ -188,6 +187,7 @@ def scan_wifi():
|
||||||
subprocess.run(['nmcli', 'dev', 'wifi', 'rescan'], check=True)
|
subprocess.run(['nmcli', 'dev', 'wifi', 'rescan'], check=True)
|
||||||
cmd = "nmcli dev wifi"
|
cmd = "nmcli dev wifi"
|
||||||
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
|
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
|
||||||
|
time.sleep(1) # 等待1秒,确保nmcli命令执行完成
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
logging.info(f"{datetime.datetime.now()}: Error scanning Wi-Fi: {e}")
|
logging.info(f"{datetime.datetime.now()}: Error scanning Wi-Fi: {e}")
|
||||||
network_error_light_1()
|
network_error_light_1()
|
||||||
|
|
Loading…
Reference in New Issue