Christ van Willegen wrote:
> Helge,
> On Wed, Oct 14, 2009 at 1:29 PM, Helge Hafting <> 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/

#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


case "$1" in

                #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
                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
                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
                $0 start
                echo "Usage: /etc/init.d/wpa {start|stop|restart}"
                exit 1
exit 0

Openmoko community mailing list

Reply via email to