larsks wrote: 
> In case anyone else has experienced this problem:
> 
> I am running a picoreplayer on a raspberry pi model b with a wireless
> connection.  I ran into a problem in which everything would work fine
> initially, but the pi would eventually drop off the network.  I believe
> this is because picoreplayer does not run wpa_supplicant for open
> networks.  Running wpa_supplicant is always recommended, even for open
> networks, because wpa_supplicant will take care of re-associating to the
> AP if the wireless connection drops.  
> 
> I have replaced the stock wifi.sh with
> http://chunk.io/f/7f617dc021dd43dcb25b4602be4fcadc?lang=text, and
> everything has been working smoothly since then.  This is a much
> simplified script that does not have any facilities for menus or
> prompting; it just reads the wireless configuration from config.cfg and
> then starts up wpa_supplicant with an appropriate configuration file.
> 
> Cheers,
> 
> -- Lars

Hi Lars,

Thanks for posting your wifi script it has reminded me that wifi setup
is overly complex.

Over a year ago I wrote an alternative wiif setup based entirely on
wpa_supplicant and wpa_cli. The problem is the current wifi has worked
very reliably for 99% of the users and I was hesitant to inflict pain
implementing a new process.  

There is one advantage using wifi.sh, it is a standard script and is
maintained by the piCore team not us. ;)

While researching wireless setup it was easy to get information overload
and there was so many ways to do it.

The following reference appealed to me, being simple to understand but
powerful enough to do it properly.

http://processors.wiki.ti.com/index.php/Connect_to_Secure_AP_using_WPA_Supplicant

Here's a snippet of code, developed from the above reference. This code
is not finalised, it was only for testing. I would probably optimise it
a bit if I was to redo it.


Code:
--------------------
    wpa_cli -iwlan0 disconnect
  
  if [ $WIFI = '"on"' ]; then
        for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`;do 
wpa_cli -iwlan0 remove_network $i; done
        wpa_cli -iwlan0 add_network
        wpa_cli -iwlan0 set_network 0 auth_alg OPEN
  
        case "$ENCRYPTION" in
                \"WPA*)
                        PASSWORD=$(echo $(wpa_passphrase `echo $SSID $PASSWORD 
| sed 's/"//g'`) | cut -d = -f 5 | cut -b 1-64)
                        wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
                        wpa_cli -iwlan0 set_network 0 psk ''$PASSWORD''
                        #wpa_cli -iwlan0 set_network 0 proto WPA
                        ;;
                \"WEP*)
                        wpa_cli -iwlan0 set_network 0 key_mgmt NONE
                        wpa_cli -iwlan0 set_network 0 wep_key0 ''$PASSWORD''
                        ;;
                \"OPEN*)
                        wpa_cli -iwlan0 set_network 0 key_mgmt NONE
                        ;;
                *)
                        ;;
        esac
  
        wpa_cli -iwlan0 set_network 0 mode 0
        wpa_cli -iwlan0 set_network 0 ssid ''$SSID''
        wpa_cli -iwlan0 set_network 0 scan_ssid 1
        wpa_cli -iwlan0 select_network 0
        wpa_cli -iwlan0 enable_network 0
        wpa_cli -iwlan0 reassociate
        wpa_cli -iwlan0 status
        wpa_cli -iwlan0 save_config
  fi
--------------------


regards
Greg


------------------------------------------------------------------------
Greg Erskine's Profile: http://forums.slimdevices.com/member.php?userid=7403
View this thread: http://forums.slimdevices.com/showthread.php?t=97803

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to