Neo FreeRunner Wifi

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (GTA02 WLAN moved to Wireless Networking: Better name as per talk page. Consistent with "USB Networking" page.)
(udhcpc requires "-i" for specifying a custom network interface)
 
(108 intermediate revisions by 40 users not shown)
Line 1: Line 1:
== What APs are available ==
+
{{Languages|Neo FreeRunner Wifi}}
  
root@om-gta02:~# iwlist eth0 scan
+
This page documents the [http://en.wikipedia.org/wiki/Wireless_networking wireless networking] solutions commonly known as [http://en.wikipedia.org/wiki/Wireless_LAN WLAN] or WiFi.
  
== Using WPA and /etc/network/interfaces==
+
There are other ways to enable wireless communications on the Neo, including [[Bluetooth]]. For Bluetooth solutions, see [[How to use bluetooth to transfer data between Neo and Desk-top]] and [[Manually using Bluetooth]].
 +
 
 +
== How can I tell what Access Points (APs) are visible to me? ==
 +
 
 +
You can connect to wireless networks through wireless [http://en.wikipedia.org/wiki/Access_point| access points]. If you want to know the names of all the access points that are currently visible to you, you can perform a scan with this command:
 +
 
 +
root@om-gta02:~# '''iwlist eth0 scan'''
 +
 
 +
If anything is visible you will get a list that looks something like this:
 +
 
 +
eth0      Scan completed :
 +
          Cell 01 - Address: 00:16:B6:DE:77:58
 +
                    ESSID:"StarvinMarvin"
 +
                    Mode:Master
 +
                    Frequency:2.437 GHz (Channel 6)
 +
                    Quality=9/94  Signal level=-86 dBm  Noise level=-95 dBm
 +
                    Encryption key:on
 +
                    Extra:bcn_int=100
 +
                    Extra:wpa_ie=dd180050f20101000050f20201000050f20201000050f2020000
 +
          Cell 02 - Address: 00:21:29:AA:10:97
 +
                    ESSID:"CandT Network"
 +
                    Mode:Master
 +
                    Frequency:2.437 GHz (Channel 6)
 +
                    Quality=39/94  Signal level=-56 dBm  Noise level=-95 dBm
 +
                    Encryption key:on
 +
                    Extra:bcn_int=100
 +
                    Extra:wpa_ie=dd1c0050f20101000050f20202000050f2040050f20201000050f2020000
 +
                    Extra:rsn_ie=30180100000fac020200000fac04000fac020100000fac020000
 +
          Cell 03 - Address: 00:14:95:1B:8E:B9
 +
                    ESSID:"2WIRE852"
 +
                    Mode:Master
 +
                    Frequency:2.437 GHz (Channel 6)
 +
                    Quality=5/94  Signal level=-90 dBm  Noise level=-95 dBm
 +
                    Encryption key:on
 +
                    Extra:bcn_int=100
 +
          Cell 04 - Address: 00:E0:98:52:3D:78
 +
                    ESSID:"smith"
 +
                    Mode:Master
 +
                    Frequency:2.437 GHz (Channel 6)
 +
                    Quality=36/94  Signal level=-59 dBm  Noise level=-95 dBm
 +
                    Encryption key:on
 +
                    Extra:bcn_int=100
 +
 
 +
If you want to connect to an unsecured network run:
 +
 
 +
  udhcpc 
 +
 
 +
 
 +
== WPA ==
 +
 
 +
[http://en.wikipedia.org/wiki/Wi-Fi_Protected_Access  WPA] is an encryption method for securing your wireless network.
 +
 
 +
=== Using wpa_supplicant manually ===
 +
 
 +
Create and edit a suitable [[GTA02_WLAN#Sample_wpa_supplicant.conf|/etc/wpa_supplicant/wpa_supplicant.conf (see below)]].
 +
 
 +
Bring up your wireless connection:
 +
 
 +
root@om-gta02:~# ifconfig eth0 up
 +
root@om-gta02:~# wpa_supplicant -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
 +
root@om-gta02:~# udhcpc -i eth0
 +
 
 +
=== Using WPA and /etc/network/interfaces ===
 +
 
 +
Once you have a [[GTA02_WLAN#Sample_wpa_supplicant.conf|/etc/wpa_supplicant/wpa_supplicant.conf (see below)]] file, add a line under the eth0 entry in /etc/network/interfaces:
  
Once you have a [[GTA02_WLAN#Sample_wpa_supplicant.conf|/etc/wpa_supplicant/wpa_supplicant.conf]] file, add a line under the eth0 entry in /etc/network/interfaces:
 
 
  iface eth0 inet dhcp
 
  iface eth0 inet dhcp
 
     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
 
     wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Line 12: Line 75:
 
   # ifdown eth0 && ifup eth0
 
   # ifdown eth0 && ifup eth0
  
You'll get a lot of messages, like <tt>ioctl[SIOCSIWENCODEEXT]: Operation not supported</tt> and <tt>sed: unrecognized option `--quiet'</tt>, they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh
+
You'll get a lot of messages, like <tt>ioctl[SIOCSIWENCODEEXT]: Operation not supported</tt> and <tt>sed: unrecognized option `--quiet'</tt>, they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh ([http://docs.openmoko.org/trac/ticket/2189 bug #2189])
  
== Using WEP and /etc/network/interfaces==
+
=== wpa_supplicant.conf ===
 +
<tt>wpa-supplicant</tt>'s conf file typically found at <tt>/etc/wpa_supplicant/wpa_supplicant.conf</tt>.
  
  iface eth0 inet dhcp
+
==== wpa_supplicant.conf explained ====
    wireless-key my_wep_key
+
The highest priority is tried first then falls back to the next highest number.
    wireless-essid my_essid
+
  
  iface eth0 inet dhcp
+
priority=100 1st  <br>
    wpa-wep-key0 my_wep_key
+
then<br>
    wpa-key-mgmt NONE
+
priority=99  <br>
    wpa-ssid my_essid
+
<pre>
  
Save your changes and run:
+
# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
  # ifdown eth0 && ifup eth0
+
network={
 +
ssid="AP_ESSID"
 +
psk="presharedkey"
 +
priority=5
 +
}
  
== Manual attempt ==
 
  
Create and edit a suitable [[GTA02_WLAN#Sample_wpa_supplicant.conf|/etc/wpa_supplicant/wpa_supplicant.conf]] 
+
#try open AP regardless of its SSID.
 +
# change root password before you go roaming around it could prove dangerous
 +
network={
 +
key_mgmt=NONE
 +
priority=1  #try any open AP last
 +
}
 +
</pre>
 +
 
 +
A more in depth explanation can be found here:<br>
 +
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf
  
root@om-gta02:~# ifup eth0
+
==== Sample wpa_supplicant.conf ====
root@om-gta02:~# wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
+
root@om-gta02:~# udhcpc eth0
+
  
== Sample wpa_supplicant.conf ==
+
Sample <tt>/etc/wpa_supplicant/wpa_supplicant.conf</tt> :
  
 
  ctrl_interface=/var/run/wpa_supplicant
 
  ctrl_interface=/var/run/wpa_supplicant
Line 84: Line 157:
 
  }
 
  }
  
======wpa_supplicant.conf explained======
+
==== Other working sample wpa_supplicant.conf files ====
highest priority tried first then falls back sequentially to the next highest number<br>
+
priority=100  1st  <br>
+
then<br>
+
priority=99  <br>
+
<pre>
+
  
# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
+
Tom Yates documents his success [http://www.teaparty.net/technotes/openmoko-2.html#Wifi here]
network={
+
ssid="AP_ESSID"
+
psk="presharedkey"
+
priority=5
+
}
+
  
 +
Matthias Apitz documents his success here: [http://www.unixarea.de/openmoko.txt http://www.unixarea.de/openmoko.txt] (see chapter 6.).
  
#try open AP regardless of its SSID.
+
==== Roaming ====
# change root password before you go roaming around it could prove dangerous
+
* Connecting to a local network with usb networking enabled, may get you into trouble. The default /etc/network/interfaces will configure the usb endpoint as a default gateway (for 2008.12). If you connect to another 192.168.0.0/24 network your phone will try the usb, timeout and then go for the other: remove the route with 'route del default gw 192.168.0.200'. Optionally remove the route from <tt>interfaces</tt> if you never intend to use your desktop as a router.
network={
+
* You can have wpa_supplicant roam for you by setting the inet method to manual and using wpa_roam instead of wpa_conf in your /etc/network/interfaces.
key_mgmt=NONE
+
* After bringing up the interface with wpa_supplicant, you can run wpa_cli and issue the command 'status' to see if and to which AP you are connected.
priority=#try any open AP last
+
 
}
+
==== Using with fsoraw ====
 +
wpa_supplicant can be invoked through fsoraw by running,
 +
 
 +
fsoraw -r WiFi -- wpa_supplicant -ieth0 -Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf
 +
 
 +
* Remember there is no need to enable WiFi radio in Settings>Connectivity as fsoraw will enable it.
 +
* The above command shall not return back to the shell, it can be sent to background using &
 +
* To terminate the connection, kill wpa_supplicant
 +
 
 +
== WEP ==
 +
 
 +
[http://en.wikipedia.org/wiki/Wired_Equivalent_Privacy WEP] is an encryption method for securing your wireless network. WEP is generally considered to be weak, you should use WPA instead if possible.
 +
 
 +
=== Using iwconfig manually ===
 +
 
 +
Note that for WEP our iwconfig requires a more specific format than generic iwconfig.
 +
 
 +
The canonical way of running iwconfig for WEP would be something like this:
 +
 
 +
# iwconfig eth0 key A4BEB3B8EC essid xyz
 +
 
 +
Two things are important here:
 +
 
 +
* the key must be in HEX. iwconfig will not do anything useful if the key is given as a string.  [http://www.powerdog.com/wepkey.cgi Here] is a handy ASCII string to HEX converter.
 +
 
 +
* the ESSID must follow the key.
 +
 
 +
If an incorrect key was set, please stop all activity on the interface for at least two minutes (i.e., killall udhcpc and ifconfig eth0 down), then issue the correct iwconfig command and retry.
 +
 
 +
==== Manually setting WEP key with index different than 1 ====
 +
 
 +
First you need to specify the key with its index as prefix or postfix:
 +
 
 +
# iwconfig eth0 key A4BEB3B8EC [2]
 +
 
 +
At this point, iwconfig doesn't show any key is used. Now you need to tell it to actually use key with index 2:
 +
 
 +
# iwconfig eth0 key [2]
 +
 
 +
Now your network with nonstandard wep index should work :)
 +
 
 +
=== Using WEP and /etc/network/interfaces ===
 +
  iface eth0 inet dhcp
 +
    wireless-key my_wep_key
 +
    wireless-essid my_essid
 +
 
 +
iface eth0 inet dhcp
 +
    wpa-wep-key0 my_wep_key
 +
    wpa-key-mgmt NONE
 +
    wpa-ssid my_essid
 +
 
 +
Save your changes and run:
 +
  # ifdown eth0 && ifup eth0
 +
Idea : You can use [http://www.opkg.org/package_28.html ShortOm] to lauch this command on futur boot to activate wifi without having to use terminal
 +
 
 +
== Known Issues ==
 +
 
 +
=== iwconfig doesn't work in all cases ===
 +
 
 +
Note that for some reason our iwconfig requires a more constrained format than the generic iwconfig. See
 +
[[Neo_FreeRunner_Wifi#Using_iwconfig_manually| using iwconfig manually]].
 +
 
 +
=== Anecdotal solutions ===
 +
 
 +
These solutions worked for some people:
 +
 
 +
==== Disable power management ====
 +
 
 +
Some APs apparently get upset by power managed devices, and the Freerunner enables power management of the wifi by default to preserve battery. One user's wrt54g certainly gets upset from time to time if he connect with the FreeRunner, sometimes refusing to talk to _anything_ over wifi afterwards until rebooted.
 +
 
 +
<pre>
 +
iwconfig eth0 power off
 
</pre>
 
</pre>
more in depth explanation see<br>
 
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf
 
  
 +
==== Modified script ====
 +
 +
"I changed the script a little:
 +
 +
Exec=xterm -e "ifconfig eth0 down \
 +
iwconfig eth0 txpower off channel 0 \
 +
while killall wpa_supplicant; do echo 'Killing wpa_sup'; done \
 +
killall udhcpc \
 +
wpa_supplicant -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext -B \
 +
sleep 10; udhcpc"
 +
 +
Now it is working every time.
 +
I am using 2008.latest (081004) and a linksys WAP54G accesspoint,
 +
 +
==== Use a different channel ====
 +
 +
"Could not get it to work properly on channel 11, so I set my accesspoint to channel 1."
 +
 +
==== Make your WIFI more reliable ====
 +
After boot or before connecting do:
 +
wmiconfig -i eth0 --power maxperf
 +
of course you need to find [[wmiconfig]] or to compile it
 +
 +
==== eth0 doesn't show up ====
 +
If a "config -a" or "lshw -c network" doesn't show the wlan interface (eth0) you might need to bind it first:
 +
 +
<pre>
 +
echo s3c2440-sdi > /sys/bus/platform/drivers/s3c2440-sdi/bind
 +
</pre>
 +
 +
If you are using FSO try using dbus.
 +
 +
<pre>
 +
root@om-gta02:~$cat scripts/wifi-on.sh
 +
#!/bin/sh
 +
mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/PowerControl/WiFi  org.freesmartphone.Resource.Enable
 +
 +
</pre>
 +
 +
== Wake up from wireless (wow)==
 +
 +
Wi-Fi module constantly drain currents after module power up, for wi-fi SIP phone or some application need long standby time, will need wake up from wireless function for power saving. There is a sleep mode that Ar6k supported for wake up from wireless.
 +
 +
http://svn.openmoko.org/trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig
 +
 +
export ATH_CROSS_COMPILE_TYPE=arm-angstrom-linux-gnueabi-
 +
make
 +
 +
Debian package:
 +
 +
wget http://meshy.org/~ato/debian/pool/main/w/wmiconfig/wmiconfig_0.0.18-1_armel.deb
 +
dpkg -i wmiconfig_0.0.18-1_armel.deb
 +
 +
Basically, it's achieved via wmiconfig tool to issue IOCTL if we want
 +
ar6k wifi module to generate interrupt to host controller. The procedure
 +
to enable wakeup-on-wireless(wow) is listed here:
 +
 +
1. wmiconfig --sethostmode asleep /* to tell ar6k what host's current is */
 +
2. wmiconfig --setwowmode enable /* enable wow function */
 +
3. wmiconfig --addwowpattern 0 1 33 01 ff /* add packet filter pattern, this is the ICMP filter pattern */
 +
4. apm -s
 +
5. ping IP_of_Neo
 +
6. The GPIO1 pin would be pulled up. The system would resume then.
 +
7. wmiconfig --sethostmode awake /* The firmware of ar6k will pull low the GPIO1 pin */
 +
 +
--addwowpattern <list-id> <pattern-size> <pattern-offset> <pattern> <pattern-mask>
 +
 +
Here are some addwowpattern commands:
  
 +
Protocol type=IP=0800
 +
Protocol type in IP header=ICMP=01
  
 +
- To filter for IP packets(offset 22)
 +
wmiconfig --addwowpattern 0 2 22 0800 ffff
 +
- To filter for ICMP packets (offset 33)
 +
wmiconfig --addwowpattern 0 1 33 01 ff
  
 
== A very ugly /etc/init.d/wlan startscript ==
 
== A very ugly /etc/init.d/wlan startscript ==
Line 133: Line 340:
 
  wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
 
  wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
 
  sleep 10
 
  sleep 10
  udhcpc eth0
+
  udhcpc -i eth0
 
  RETVAL=$?
 
  RETVAL=$?
 
  return $RETVAL
 
  return $RETVAL
Line 168: Line 375:
 
  exit $RETVAL
 
  exit $RETVAL
  
 +
Note: Don't forget to make this script executable with "chmod +x <filename>"
  
== Success stories ==
+
== Route internet connection through Wifi rather than USB ==
  
=== July 23, 2008 ===
+
Wifi is faster than USB, so it is a good idea to tell the FreeRunner to connect through it. Put the following in /etc/network/interfaces under eth0:
  
wpa_supplicant 0.6.3-r1 works for me with WPA and WPA2 (with PSK) using the config file template on this page. Unlike the comment above, udhcpc is updating /etc/resolver.conf correctly for me (perhaps this is an old problem).  
+
  up route del default gw 192.168.0.200
  
Bringing up wpa_supplicant manually or using "ifup eth0" with the wpa-conf option set in /etc/network/interfaces works for me. If usb0 was already up when running "ifup eth0" you'll end up with 2 default routes which can cause problems. To solve this either take usb0 down first or run "ip route del default dev usb0" to remove the default route to usb0.
+
This will remove your computer as the default gateway and use the  wireless one when the interface is brought up. User nickd reports that sometimes it fails so he has had to put it in twice.
  
=== July 19, 2008 ===
+
== ssh into FR over Other Network Interfaces ==
 +
dropbear, the ssh server, is configured to listen on the USB interface only. Wireless interfaces like wlan or bluetooth are disabled for security reasons (empty root password). Therefore:
  
I've had repeated success with:
+
* Be careful with this config file since it can close the only door into your phone.
# ifconfig eth0 up
+
# iwconfig eth0 essid any
+
# iwconfig eth0 key '...'
+
# iwconfig eth0 essid '...'
+
# udhcpc eth0
+
# ifconfig usb0 down; ifconfig usb0 up
+
  
Hope that helps someone. This is for WEP.
+
* '''Set a root password!'''
  
=== July 26, 2008 ===
+
==== ssh into FR over WiFi Only ====
  
I've been able to connect to a variety of networks including WPA2 without too much difficulty.
+
Change the /etc/default/dropbear from:
Follow the above steps in configuring your wpa_supplicant.conf and adding the line to load the supplicant in /etc/network/interfaces.
+
  
My sample WPA2 configuration is as follows:
+
  DROPBEAR_PORT=`ip addr list usb0 | awk 'BEGIN { FS="[ /]+" } /inet / { print  $3 }'`:22
#WPA2
+
 
network={
+
(which actually only prepends the usb0 ip address before the :22)
  ssid="MY_SSID"
+
 
  scan_ssid=1
+
into:
  proto=RSN
+
 
  key_mgmt=WPA-PSK
+
   DROPBEAR_PORT=`ip addr list eth0 | awk 'BEGIN { FS="[ /]+" } /inet / { print  $3 }'`:22
  pairwise=CCMP TKIP
+
  group=CCMP TKIP
+
   psk="PASSWORD_PRESHARED_KEY"
+
  priority=50
+
}
+
  
That configuration will allow you to connect to a WPA2-Personal network with TKIP key encryption.
+
(which now prepends the eth0 (WLAN interface) ip address before the :22)
  
The "ifup eth0" command will connect you via WiFi.  If you don't get a lease the first time, try again.  Sometimes the configuration is a little too slow and DHCP tries to get a lease before a successful connection to your access point has been established.
+
==== ssh into FR over Any Network Interface ====
  
 +
Change the /etc/default/dropbear from:
  
 +
  DROPBEAR_PORT=`ip addr list usb0 | awk 'BEGIN { FS="[ /]+" } /inet / { print  $3 }'`:22
  
The following may be helpful in order to scan available networks :
+
(which actually only prepends the usb0 ip address before the :22)
# iwlist eth0 scan
+
  
== Available Software ==
+
into:
  
Here are some applications available to aid in WiFi administration:
+
  DROPBEAR_PORT=*:22
  
=== lint-wifi ===
+
== See also ==
lint-wifi work in progress<br>
+
http://wiki.openmoko.org/wiki/Lint-wifi
+
  
=== Mofi ===
+
* [[KnjMokoWifi]] GUI interface to administer WiFi connections
 +
* [[wmiconfig]] Atheros utility to config the wifi chip used in Neo FreeRunner
 +
* [[Lint-wifi]] GUI interface to administer WiFi connections
 +
* [[Mofi]] GUI interface to administer WiFi connections
 +
* [[Camp-Wifi]] GUI interface to administer WiFi connections
  
Mofi is software for the OpenMoko platform allowing phone users to search for and connect to wireless access points within range.
+
== External links ==
  
*[http://projects.openmoko.org/frs/download.php/277/mofi_0.02_armv4t.ipk download ipk] [http://wiki.openmoko.org/wiki/Mofi#Through_opkg (installation notes)]
+
* [http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/ WiFi on Linux]
*[http://wiki.openmoko.org/wiki/mofi more info]
+
  
[[Category:GTA02 Hardware]]
+
[[Category:Neo FreeRunner Hardware]]
 +
[[Category:Wlan software| ]]

Latest revision as of 11:38, 10 March 2011


This page documents the wireless networking solutions commonly known as WLAN or WiFi.

There are other ways to enable wireless communications on the Neo, including Bluetooth. For Bluetooth solutions, see How to use bluetooth to transfer data between Neo and Desk-top and Manually using Bluetooth.

Contents

[edit] How can I tell what Access Points (APs) are visible to me?

You can connect to wireless networks through wireless access points. If you want to know the names of all the access points that are currently visible to you, you can perform a scan with this command:

root@om-gta02:~# iwlist eth0 scan

If anything is visible you will get a list that looks something like this:

eth0      Scan completed :
          Cell 01 - Address: 00:16:B6:DE:77:58
                    ESSID:"StarvinMarvin"
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Quality=9/94  Signal level=-86 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Extra:bcn_int=100
                    Extra:wpa_ie=dd180050f20101000050f20201000050f20201000050f2020000
          Cell 02 - Address: 00:21:29:AA:10:97
                    ESSID:"CandT Network"
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Quality=39/94  Signal level=-56 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Extra:bcn_int=100
                    Extra:wpa_ie=dd1c0050f20101000050f20202000050f2040050f20201000050f2020000
                    Extra:rsn_ie=30180100000fac020200000fac04000fac020100000fac020000
          Cell 03 - Address: 00:14:95:1B:8E:B9
                    ESSID:"2WIRE852"
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Quality=5/94  Signal level=-90 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Extra:bcn_int=100
          Cell 04 - Address: 00:E0:98:52:3D:78
                    ESSID:"smith"
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Quality=36/94  Signal level=-59 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Extra:bcn_int=100

If you want to connect to an unsecured network run:

 udhcpc  


[edit] WPA

WPA is an encryption method for securing your wireless network.

[edit] Using wpa_supplicant manually

Create and edit a suitable /etc/wpa_supplicant/wpa_supplicant.conf (see below).

Bring up your wireless connection:

root@om-gta02:~# ifconfig eth0 up
root@om-gta02:~# wpa_supplicant -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
root@om-gta02:~# udhcpc -i eth0

[edit] Using WPA and /etc/network/interfaces

Once you have a /etc/wpa_supplicant/wpa_supplicant.conf (see below) file, add a line under the eth0 entry in /etc/network/interfaces:

iface eth0 inet dhcp
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Save your changes and run:

 # ifdown eth0 && ifup eth0

You'll get a lot of messages, like ioctl[SIOCSIWENCODEEXT]: Operation not supported and sed: unrecognized option `--quiet', they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh (bug #2189)

[edit] wpa_supplicant.conf

wpa-supplicant's conf file typically found at /etc/wpa_supplicant/wpa_supplicant.conf.

[edit] wpa_supplicant.conf explained

The highest priority is tried first then falls back to the next highest number.

priority=100 1st
then
priority=99

 

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
network={
	ssid="AP_ESSID"
	psk="presharedkey"
	priority=5
}


#try open AP regardless of its SSID.
# change root password before you go roaming around it could prove dangerous
network={
	key_mgmt=NONE
priority=1  #try any open AP last
}

A more in depth explanation can be found here:
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf

[edit] Sample wpa_supplicant.conf

Sample /etc/wpa_supplicant/wpa_supplicant.conf :

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1 
# WPA2:
network={
       ssid="your ssid"
       scan_ssid=1
       proto=RSN
       key_mgmt=WPA-PSK
       pairwise=CCMP TKIP
       group=TKIP CCMP
       psk="secret key"
       priority=50
}

# WPA:
network={
      ssid="your_ssid"
      proto=WPA
      key_mgmt=WPA-PSK
      pairwise=TKIP
      group=TKIP
      scan_ssid=1
      psk="secret key"
      priority=10
}

# WEP:
network={
     ssid="your_ssid"
     scan_ssid=1
     key_mgmt=NONE
     wep_tx_keyidx=0
     wep_key0=your_hex_key
     priority=8
}

# Open:
network={
     ssid="your ssid"
     key_mgmt=NONE
     priority=5
}

[edit] Other working sample wpa_supplicant.conf files

Tom Yates documents his success here

Matthias Apitz documents his success here: http://www.unixarea.de/openmoko.txt (see chapter 6.).

[edit] Roaming

  • Connecting to a local network with usb networking enabled, may get you into trouble. The default /etc/network/interfaces will configure the usb endpoint as a default gateway (for 2008.12). If you connect to another 192.168.0.0/24 network your phone will try the usb, timeout and then go for the other: remove the route with 'route del default gw 192.168.0.200'. Optionally remove the route from interfaces if you never intend to use your desktop as a router.
  • You can have wpa_supplicant roam for you by setting the inet method to manual and using wpa_roam instead of wpa_conf in your /etc/network/interfaces.
  • After bringing up the interface with wpa_supplicant, you can run wpa_cli and issue the command 'status' to see if and to which AP you are connected.

[edit] Using with fsoraw

wpa_supplicant can be invoked through fsoraw by running,

fsoraw -r WiFi -- wpa_supplicant -ieth0 -Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf

  • Remember there is no need to enable WiFi radio in Settings>Connectivity as fsoraw will enable it.
  • The above command shall not return back to the shell, it can be sent to background using &
  • To terminate the connection, kill wpa_supplicant

[edit] WEP

WEP is an encryption method for securing your wireless network. WEP is generally considered to be weak, you should use WPA instead if possible.

[edit] Using iwconfig manually

Note that for WEP our iwconfig requires a more specific format than generic iwconfig.

The canonical way of running iwconfig for WEP would be something like this:

  1. iwconfig eth0 key A4BEB3B8EC essid xyz

Two things are important here:

  • the key must be in HEX. iwconfig will not do anything useful if the key is given as a string. Here is a handy ASCII string to HEX converter.
  • the ESSID must follow the key.

If an incorrect key was set, please stop all activity on the interface for at least two minutes (i.e., killall udhcpc and ifconfig eth0 down), then issue the correct iwconfig command and retry.

[edit] Manually setting WEP key with index different than 1

First you need to specify the key with its index as prefix or postfix:

  1. iwconfig eth0 key A4BEB3B8EC [2]

At this point, iwconfig doesn't show any key is used. Now you need to tell it to actually use key with index 2:

  1. iwconfig eth0 key [2]

Now your network with nonstandard wep index should work :)

[edit] Using WEP and /etc/network/interfaces

 iface eth0 inet dhcp
   wireless-key my_wep_key
   wireless-essid my_essid
iface eth0 inet dhcp
   wpa-wep-key0 my_wep_key
   wpa-key-mgmt NONE
   wpa-ssid my_essid

Save your changes and run:

 # ifdown eth0 && ifup eth0

Idea : You can use ShortOm to lauch this command on futur boot to activate wifi without having to use terminal

[edit] Known Issues

[edit] iwconfig doesn't work in all cases

Note that for some reason our iwconfig requires a more constrained format than the generic iwconfig. See using iwconfig manually.

[edit] Anecdotal solutions

These solutions worked for some people:

[edit] Disable power management

Some APs apparently get upset by power managed devices, and the Freerunner enables power management of the wifi by default to preserve battery. One user's wrt54g certainly gets upset from time to time if he connect with the FreeRunner, sometimes refusing to talk to _anything_ over wifi afterwards until rebooted.

iwconfig eth0 power off

[edit] Modified script

"I changed the script a little:

Exec=xterm -e "ifconfig eth0 down \
iwconfig eth0 txpower off channel 0 \
while killall wpa_supplicant; do echo 'Killing wpa_sup'; done \
killall udhcpc \
wpa_supplicant -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext -B \
sleep 10; udhcpc"

Now it is working every time. I am using 2008.latest (081004) and a linksys WAP54G accesspoint,

[edit] Use a different channel

"Could not get it to work properly on channel 11, so I set my accesspoint to channel 1."

[edit] Make your WIFI more reliable

After boot or before connecting do:

wmiconfig -i eth0 --power maxperf

of course you need to find wmiconfig or to compile it

[edit] eth0 doesn't show up

If a "config -a" or "lshw -c network" doesn't show the wlan interface (eth0) you might need to bind it first:

echo s3c2440-sdi > /sys/bus/platform/drivers/s3c2440-sdi/bind

If you are using FSO try using dbus.

root@om-gta02:~$cat scripts/wifi-on.sh 
#!/bin/sh
 mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/PowerControl/WiFi  org.freesmartphone.Resource.Enable

[edit] Wake up from wireless (wow)

Wi-Fi module constantly drain currents after module power up, for wi-fi SIP phone or some application need long standby time, will need wake up from wireless function for power saving. There is a sleep mode that Ar6k supported for wake up from wireless.

http://svn.openmoko.org/trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig
export ATH_CROSS_COMPILE_TYPE=arm-angstrom-linux-gnueabi-
make

Debian package:

wget http://meshy.org/~ato/debian/pool/main/w/wmiconfig/wmiconfig_0.0.18-1_armel.deb
dpkg -i wmiconfig_0.0.18-1_armel.deb

Basically, it's achieved via wmiconfig tool to issue IOCTL if we want ar6k wifi module to generate interrupt to host controller. The procedure to enable wakeup-on-wireless(wow) is listed here:

1. wmiconfig --sethostmode asleep /* to tell ar6k what host's current is */
2. wmiconfig --setwowmode enable /* enable wow function */
3. wmiconfig --addwowpattern 0 1 33 01 ff /* add packet filter pattern, this is the ICMP filter pattern */
4. apm -s
5. ping IP_of_Neo
6. The GPIO1 pin would be pulled up. The system would resume then.
7. wmiconfig --sethostmode awake /* The firmware of ar6k will pull low the GPIO1 pin */

--addwowpattern <list-id> <pattern-size> <pattern-offset> <pattern> <pattern-mask>

Here are some addwowpattern commands:

Protocol type=IP=0800 Protocol type in IP header=ICMP=01

- To filter for IP packets(offset 22)
wmiconfig --addwowpattern 0 2 22 0800 ffff
- To filter for ICMP packets (offset 33)
wmiconfig --addwowpattern 0 1 33 01 ff

[edit] A very ugly /etc/init.d/wlan startscript

#!/bin/sh
#
# wlan	This shell script starts and stops wlan.
#
# processname: wlan

# Source function library.
#. /etc/rc.d/init.d/functions
# "written" by HdR

RETVAL=0
prog="wlan"

# test -f /etc/default/$prog && . /etc/default/$prog

start() {
	echo -n "Starting $prog: "
	ifconfig eth0 up
	wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
	sleep 10
	udhcpc -i eth0
	RETVAL=$?
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n "Shutting down $prog: "
        killall wpa_supplicant
	ifconfig eth0 down
#        killproc gpsd
	RETVAL=$?
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $RETVAL

Note: Don't forget to make this script executable with "chmod +x <filename>"

[edit] Route internet connection through Wifi rather than USB

Wifi is faster than USB, so it is a good idea to tell the FreeRunner to connect through it. Put the following in /etc/network/interfaces under eth0:

 up route del default gw 192.168.0.200

This will remove your computer as the default gateway and use the wireless one when the interface is brought up. User nickd reports that sometimes it fails so he has had to put it in twice.

[edit] ssh into FR over Other Network Interfaces

dropbear, the ssh server, is configured to listen on the USB interface only. Wireless interfaces like wlan or bluetooth are disabled for security reasons (empty root password). Therefore:

  • Be careful with this config file since it can close the only door into your phone.
  • Set a root password!

[edit] ssh into FR over WiFi Only

Change the /etc/default/dropbear from:

 DROPBEAR_PORT=`ip addr list usb0 | awk 'BEGIN { FS="[ /]+" } /inet / { print  $3 }'`:22

(which actually only prepends the usb0 ip address before the :22)

into:

 DROPBEAR_PORT=`ip addr list eth0 | awk 'BEGIN { FS="[ /]+" } /inet / { print  $3 }'`:22

(which now prepends the eth0 (WLAN interface) ip address before the :22)

[edit] ssh into FR over Any Network Interface

Change the /etc/default/dropbear from:

 DROPBEAR_PORT=`ip addr list usb0 | awk 'BEGIN { FS="[ /]+" } /inet / { print  $3 }'`:22

(which actually only prepends the usb0 ip address before the :22)

into:

 DROPBEAR_PORT=*:22

[edit] See also

  • KnjMokoWifi GUI interface to administer WiFi connections
  • wmiconfig Atheros utility to config the wifi chip used in Neo FreeRunner
  • Lint-wifi GUI interface to administer WiFi connections
  • Mofi GUI interface to administer WiFi connections
  • Camp-Wifi GUI interface to administer WiFi connections

[edit] External links

Personal tools

What APs are available

root@om-gta02:~# iwlist eth0 scan

Using WPA and /etc/network/interfaces

Once you have a /etc/wpa_supplicant/wpa_supplicant.conf file, add a line under the eth0 entry in /etc/network/interfaces:

iface eth0 inet dhcp
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Save your changes and run:

 # ifdown eth0 && ifup eth0

You'll get a lot of messages, like ioctl[SIOCSIWENCODEEXT]: Operation not supported and sed: unrecognized option `--quiet', they appear to be harmless. The "--quiet" error message can be avoided by replacing "sed --quiet" with "sed -n" in /etc/wpa_supplicant/*.sh

Using WEP and /etc/network/interfaces

 iface eth0 inet dhcp
   wireless-key my_wep_key
   wireless-essid my_essid
iface eth0 inet dhcp
   wpa-wep-key0 my_wep_key
   wpa-key-mgmt NONE
   wpa-ssid my_essid

Save your changes and run:

 # ifdown eth0 && ifup eth0

Manual attempt

Create and edit a suitable /etc/wpa_supplicant/wpa_supplicant.conf

root@om-gta02:~# ifup eth0
root@om-gta02:~# wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
root@om-gta02:~# udhcpc eth0

Sample wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1 
# WPA2:
network={
       ssid="your ssid"
       scan_ssid=1
       proto=RSN
       key_mgmt=WPA-PSK
       pairwise=CCMP TKIP
       group=TKIP CCMP
       psk="secret key"
       priority=50
}

# WPA:
network={
      ssid="your_ssid"
      proto=WPA
      key_mgmt=WPA-PSK
      pairwise=TKIP
      group=TKIP
      scan_ssid=1
      psk="secret key"
      priority=10
}

# WEP:
network={
     ssid="your_ssid"
     scan_ssid=1
     key_mgmt=NONE
     wep_tx_keyidx=0
     wep_key0=your_hex_key
     priority=8
}

# Open:
network={
     ssid="your ssid"
     key_mgmt=NONE
     priority=5
}
wpa_supplicant.conf explained

highest priority tried first then falls back sequentially to the next highest number
priority=100 1st
then
priority=99

 

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
network={
	ssid="AP_ESSID"
	psk="presharedkey"
	priority=5
}


#try open AP regardless of its SSID.
# change root password before you go roaming around it could prove dangerous
network={
	key_mgmt=NONE
priority=1  #try any open AP last
}

more in depth explanation see
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf



A very ugly /etc/init.d/wlan startscript

#!/bin/sh
#
# wlan	This shell script starts and stops wlan.
#
# processname: wlan

# Source function library.
#. /etc/rc.d/init.d/functions
# "written" by HdR

RETVAL=0
prog="wlan"

# test -f /etc/default/$prog && . /etc/default/$prog

start() {
	echo -n "Starting $prog: "
	ifconfig eth0 up
	wpa_supplicant -ieth0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
	sleep 10
	udhcpc eth0
	RETVAL=$?
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n "Shutting down $prog: "
        killall wpa_supplicant
	ifconfig eth0 down
#        killproc gpsd
	RETVAL=$?
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $RETVAL


Success stories

July 23, 2008

wpa_supplicant 0.6.3-r1 works for me with WPA and WPA2 (with PSK) using the config file template on this page. Unlike the comment above, udhcpc is updating /etc/resolver.conf correctly for me (perhaps this is an old problem).

Bringing up wpa_supplicant manually or using "ifup eth0" with the wpa-conf option set in /etc/network/interfaces works for me. If usb0 was already up when running "ifup eth0" you'll end up with 2 default routes which can cause problems. To solve this either take usb0 down first or run "ip route del default dev usb0" to remove the default route to usb0.

July 19, 2008

I've had repeated success with:

# ifconfig eth0 up
# iwconfig eth0 essid any
# iwconfig eth0 key '...'
# iwconfig eth0 essid '...'
# udhcpc eth0
# ifconfig usb0 down; ifconfig usb0 up

Hope that helps someone. This is for WEP.

July 26, 2008

I've been able to connect to a variety of networks including WPA2 without too much difficulty. Follow the above steps in configuring your wpa_supplicant.conf and adding the line to load the supplicant in /etc/network/interfaces.

My sample WPA2 configuration is as follows:

  1. WPA2

network={

 ssid="MY_SSID"
 scan_ssid=1
 proto=RSN
 key_mgmt=WPA-PSK
 pairwise=CCMP TKIP
 group=CCMP TKIP
 psk="PASSWORD_PRESHARED_KEY"
 priority=50

}

That configuration will allow you to connect to a WPA2-Personal network with TKIP key encryption.

The "ifup eth0" command will connect you via WiFi. If you don't get a lease the first time, try again. Sometimes the configuration is a little too slow and DHCP tries to get a lease before a successful connection to your access point has been established.


The following may be helpful in order to scan available networks :

# iwlist eth0 scan

Available Software

Here are some applications available to aid in WiFi administration:

lint-wifi

lint-wifi work in progress
http://wiki.openmoko.org/wiki/Lint-wifi

Mofi

Mofi is software for the OpenMoko platform allowing phone users to search for and connect to wireless access points within range.