From c09fa3ca72885dfed3d511c1c7c7823c882337dc Mon Sep 17 00:00:00 2001 From: PaulVua Date: Tue, 17 Mar 2026 19:08:59 +0100 Subject: [PATCH] Fix forget_wifi scan: delai 5s + rescan explicite avant scan WiFi Apres disconnect wlan0, l'interface a besoin de temps pour etre prete a scanner. Ajout sleep 5 + nmcli wifi rescan + sleep 3 avant le scan. Log du contenu CSV pour debug. Co-Authored-By: Claude Opus 4.6 (1M context) --- forget_wifi.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/forget_wifi.sh b/forget_wifi.sh index 463aa33..53d6ff6 100644 --- a/forget_wifi.sh +++ b/forget_wifi.sh @@ -31,13 +31,16 @@ else echo "Failed to delete connection '$ACTIVE_WIFI'" fi -sleep 1 +sleep 5 # Scan WiFi networks BEFORE starting hotspot (scan impossible once hotspot is active) OUTPUT_FILE="/var/www/nebuleair_pro_4g/wifi_list.csv" -echo "Scanning WiFi networks..." -nmcli -f SSID,SIGNAL,SECURITY device wifi list | awk 'BEGIN { OFS=","; print "SSID,SIGNAL,SECURITY" } NR>1 { print $1,$2,$3 }' > "$OUTPUT_FILE" +echo "Scanning WiFi networks (waiting for wlan0 to be ready)..." +nmcli device wifi rescan ifname wlan0 2>/dev/null +sleep 3 +nmcli -f SSID,SIGNAL,SECURITY device wifi list ifname wlan0 | awk 'BEGIN { OFS=","; print "SSID,SIGNAL,SECURITY" } NR>1 { print $1,$2,$3 }' > "$OUTPUT_FILE" echo "WiFi scan saved to $OUTPUT_FILE" +cat "$OUTPUT_FILE" # Start hotspot echo "Starting hotspot with SSID: $DEVICE_NAME"