tazpanel rev 247 1.4

Improve wifi connection
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 29 03:15:06 2012 +0100 (2012-02-29)
parents aa12dc99e177
children fdac233bd901
files network.cgi
line diff
     1.1 --- a/network.cgi	Tue Feb 28 22:28:12 2012 +0100
     1.2 +++ b/network.cgi	Wed Feb 29 03:15:06 2012 +0100
     1.3 @@ -63,6 +63,18 @@
     1.4  	table_end
     1.5  }
     1.6  
     1.7 +# Start a wifi connection
     1.8 +start_wifi() {
     1.9 +	sed -i \
    1.10 +		-e s'/^DHCP=.*/DHCP="yes"/' \
    1.11 +		-e s'/^WIFI=.*/WIFI="yes"/' \
    1.12 +		-e s'/^STATIC=.*/STATIC="no"/'/etc/network.conf
    1.13 +	ifconfig $WIFI_INTERFACE up
    1.14 +	iwconfig $WIFI_INTERFACE txpower auto
    1.15 +	/etc/init.d/network.sh start | log
    1.16 +	sleep 2
    1.17 +}
    1.18 +
    1.19  # Actions commands before page is displayed
    1.20  case " $(GET) " in
    1.21  	*\ start\ *)
    1.22 @@ -72,13 +84,7 @@
    1.23  		sleep 2 ;;
    1.24  	*\ stop\ *)
    1.25  		/etc/init.d/network.sh stop | log ;;
    1.26 -	*\ start-wifi\ *)
    1.27 -		sed -i \
    1.28 -			-e s'/^DHCP=.*/DHCP="yes"/' \
    1.29 -			-e s'/^WIFI=.*/WIFI="yes"/' \
    1.30 -			-e s'/^STATIC=.*/STATIC="no"/'/etc/network.conf
    1.31 -		/etc/init.d/network.sh start | log
    1.32 -		sleep 2 ;;
    1.33 +	*\ start-wifi\ *) start_wifi ;;
    1.34  	*\ hostname\ *)
    1.35  		echo $(gettext "Changed hostname:") $(GET hostname) | log
    1.36  		echo "$(GET hostname)" > /etc/hostname ;;
    1.37 @@ -205,20 +211,14 @@
    1.38  			WIFI_KEY_TYPE=none
    1.39  			[ -n "$(GET key)" ] && WIFI_KEY="$(GET key)"
    1.40  			[ -n "$(GET keytype)" ] && WIFI_KEY_TYPE="$(GET keytype)"
    1.41 +			/etc/init.d/network.sh stop | log
    1.42  			sed -i \
    1.43 -				-e s'/^DHCP=.*/DHCP="yes"/' \
    1.44 -				-e s'/^STATIC=.*/STATIC="no"/' \
    1.45 -				-e s'/^WIFI=.*/WIFI="yes"/' \
    1.46  				-e s"/^WIFI_ESSID=.*/WIFI_ESSID=\"$(GET essid)\""/ \
    1.47  				-e s"/^WIFI_KEY=.*/WIFI_KEY=\"$WIFI_KEY\"/" \
    1.48  				-e s"/^WIFI_KEY_TYPE=.*/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/" \
    1.49  				/etc/network.conf
    1.50 -			# BUGGY
    1.51 -			#/etc/init.d/network stop | log
    1.52 -			# sleep 2
    1.53 -			/etc/init.d/network start | log
    1.54 -			sleep 2
    1.55  			. /etc/network.conf
    1.56 +			start_wifi
    1.57  		fi
    1.58  		# ESSID names are clickable
    1.59  		if [ "$(GET select)" ]; then