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