Thanks for good work on the WIFI driver

Helge Hafting helge.hafting at hist.no
Thu Oct 15 14:10:43 CEST 2009


Christ van Willegen wrote:
> Helge,
> 
> On Wed, Oct 14, 2009 at 1:29 PM, Helge Hafting <helge.hafting at hist.no> wrote:
>> Wifi used to be very unstable and quirky, but is much improved now.
> I agree!
> 
>> I can now run a script that powers up wifi, loads the kernel
>> driver module, and then runs wpa-supplicant and udhcpc. And it
>> works - everytime!
> 
> Could you share this script with us? Or put it on the WIki?

Here is the script. Made so it will work from /etc/init.d/


#!/bin/sh
#Start wireless using wpa_supplicant and udhcpc
#
#Contains a sleep, not meant to be run as a starupt script.
#works great interactively, or from SHR settings

PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin

case "$1" in
	start)

		#Get rid of any old daemons:
		killall wpa_supplicant
		killall udhcpc

		echo Power up!
		#Power up WIFI, in case it is off
		mdbus -s org.freesmartphone.odeviced \
/org/freesmartphone/Device/PowerControl/WiFi \
org.freesmartphone.Device.PowerControl.SetPower 1

		#Work around bugs:
		echo Reload!
		#The driver is borked after suspend, so
		#reload it:
		#(not sure if this step is still necessary,
		#it definitely was before.)
		rmmod ar6000 ; modprobe ar6000 ; sleep 2

		#Run wpa_supplicant, it will look for known networks
		#and associate to one of them. You need your own
		#/etc/wpa_supplicant/wpa_supplicant.conf
		echo Starting wpa_supplicant
		wpa_supplicant -i eth0 -Dwext \
-c/etc/wpa_supplicant/wpa_supplicant.conf &

		#give it a little time (no ifplugd yet)
		#My phone needs 12-14 seconds before it associates.
		sleep 20

		#Attempt dhcp
		udhcpc eth0
		;;
	stop)
		killall udhcpc
		killall wpa_supplicant
		#Save power by turning the interface off
		ifconfig eth0 down
		rmmod ar6000
		#Power down the hardware too:
		mdbus -s org.freesmartphone.odeviced \
/org/freesmartphone/Device/PowerControl/WiFi \
org.freesmartphone.Device.PowerControl.SetPower 0
		;;
	restart)
		$0 start
		;;
	*)
		echo "Usage: /etc/init.d/wpa {start|stop|restart}"
		exit 1
		;;
esac
exit 0



More information about the community mailing list