From e13ee23fd2d0035150d178fc683079696fb446fc Mon Sep 17 00:00:00 2001 From: James Rayner Date: Mon, 14 Jul 2008 21:24:33 +1000 Subject: Add some useful error messages to wireless code Additionally add optional WIRELESS_TIMEOUT parameter Signed-off-by: Aaron Griffin --- network | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'network') diff --git a/network b/network index 8c17ee7..a7dd136 100755 --- a/network +++ b/network @@ -18,11 +18,9 @@ ifup() echo "usage: $0 ifup " return 1 fi - eval iwcfg="\$wlan_${1}" - if [ "$iwcfg" != "" ]; then - /usr/sbin/iwconfig $iwcfg - /bin/sleep 2 - fi + + wi_up $1 || return 1 + eval ifcfg="\$${1}" if [ "$ifcfg" = "dhcp" ]; then # remove the .pid file if it exists @@ -35,6 +33,23 @@ ifup() return $? } +wi_up() +{ + eval iwcfg="\$wlan_${1}" + [ "$iwcfg" = "" ] && return 0 + + /usr/sbin/iwconfig $iwcfg + [[ -z "$WIRELESS_TIMEOUT" ]] && WIRELESS_TIMEOUT=2 + sleep $WIRELESS_TIMEOUT + + bssid=`iwgetid $1 -ra` + if [[ "$bssid" = "00:00:00:00:00:00" ]]; then + printhl "Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no security" + return 1 + fi + return 0 +} + ifdown() { if [ "$1" = "" ]; then -- cgit v1.2.3