--- ifup-wireless.orig 2005-09-30 20:51:15.000000000 +0200 +++ ifup-wireless 2006-04-07 16:09:01.000000000 +0200 @@ -30,6 +30,35 @@ # Only meant to be called from ifup. +if wpa_cli -i $DEVICE status >/dev/null 2>&1; then + eval $(wpa_cli -i${DEVICE} status | grep wpa_state 2>/dev/null) + if [ "$wpa_state" != "COMPLETED" ]; then + /sbin/ip link set $DEVICE down + /sbin/ip link set $DEVICE up + wpa_cli scan >/dev/null 2>&1 + fi + old_state="" + cnt=0 + while true; do + eval $(wpa_cli -i${DEVICE} status | grep 'wpa_state|ssid' 2>/dev/null) + if [ "$wpa_state" = "COMPLETED" ]; then + echo $"Connected to $ssid" + break + fi + if [ "$old_state" != "$wpa_state" ]; then + echo -n "$wpa_state " + old_state=$wpa_state + fi + + sleep 1 + cnt=$[$cnt + 1] + if [ $cnt -gt 90 ]; then + echo -n $"Timeout " + exit 10 + fi + done +else + # Mode need to be first : some settings apply only in a specific mode ! if [ -n "$MODE" ] ; then iwconfig $DEVICE mode $MODE @@ -97,3 +126,5 @@ # use any essid iwconfig $DEVICE essid any >/dev/null 2>&1 fi + +fi