diff options
-rw-r--r-- | src/8021x | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -130,7 +130,7 @@ list_networks() { } wpa_supplicant_scan_info() { - local INTERFACE="$1" fields="$2" essids spawned_wpa=0 + local INTERFACE="$1" fields="$2" spawned_wpa=0 essids scan_wait # temp file used, as keeping ESSID's with spaces in their name in arrays # is hard, obscure and kinda nasty. This is simpler and clearer. @@ -138,12 +138,18 @@ wpa_supplicant_scan_info() { essids=$(mktemp --tmpdir essid.XXXXXXXX) if [[ "$(wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" ping 2> /dev/null)" != "PONG" ]]; then - start_wpa "$INTERFACE" "" nl80211,wext || return 1 + start_wpa "$INTERFACE" "" "${WPA_DRIVER:-nl80211,wext}" || return 1 spawned_wpa=1 fi wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" scan &> /dev/null - sleep 2.5 + # Wait at least 2 seconds for scan results + sleep 2 + # Sometimes, that is not enough (FS#29946) + for (( scan_wait = 2; scan_wait < 10; scan_wait++ )); do + wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" status | grep -q "wpa_state=SCANNING" || break + sleep 1 + done wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" scan_results | grep -v "^Selected" | grep -v "^bssid" | |