Mac80211 based open source architecture

From OMAPpedia

(Difference between revisions)
Jump to: navigation, search
(Procedure to build WLAN and test on Ubuntu FS)
 
(22 intermediate revisions not shown)
Line 1: Line 1:
-
=MAC80211 based Wilink: Description=
+
=mac80211 based WLAN driver: Description=
-
As of March 2011, Linux 2.6.37 RC4  kernel supports WLAN in the 'station mode.' Soft access point (SoftAP) feature is going to be supported from Linux kernel 39 onwards. Alternatively, you can apply just the wireless patches to your present kernel. To do so, you can use compact wireless [http://git.kernel.org/?p=linux/kernel/git/luca/wl12xx.git;a=summary wl12xx.git] to pull the SoftAP patches; and then apply them to your kernel code.
+
Linux 2.6.39 RC1 kernel and up support WLAN in the 'station mode.' Soft access point (SoftAP) feature is going to be supported from Linux kernel 39 onwards. Alternatively, you can apply just the wireless patches to your present kernel. To do so, you can use compact wireless [http://git.kernel.org/?p=linux/kernel/git/luca/wl12xx.git;a=summary wl12xx.git] to pull the SoftAP patches; and then apply them to your kernel code.
=Procedure to build WLAN and test on Ubuntu FS=
=Procedure to build WLAN and test on Ubuntu FS=
-
 
+
==To enable WLAN on the Panda Board Linux Kernel (<= v3.4-rc7)==
-
==To enable WLAN on the Panda Board Linux Kernel==
+
-
 
+
-
*Patch series required to enable WLAN on Panda are at [http://www.mail-archive.com/linux-omap@vger.kernel.org/msg44156.html Panda: Support for WLAN on WL127x]
+
-
* Make sure you have the dependent patches for WLAN clock and HWMOD changes for MMC.<br />
+
-
 
+
-
::Please refer to the following links for WLAN clock patches: [https://patchwork.kernel.org/patch/546381/ Patch 1] and [https://patchwork.kernel.org/patch/546401/ Patch 2].<br />
+
-
 
+
-
::For original patches (of adoptation for HSMMC refer to): [http://www.mail-archive.com/linux-omap@vger.kernel.org/msg43464.html OMAP: HSMMC: HWMOD adaptation]
+
* Changes in the Linux Configuration for Kernel Building:
* Changes in the Linux Configuration for Kernel Building:
-
 
:Enable WLAN on Panda Board in the kernel configuration menu:
:Enable WLAN on Panda Board in the kernel configuration menu:
     Device Drivers  --->  
     Device Drivers  --->  
Line 22: Line 13:
                     <M>  TI wl12xx support   
                     <M>  TI wl12xx support   
                         <M>    TI wl12xx SDIO support
                         <M>    TI wl12xx SDIO support
-
:Enable "nl80211 testmode command" in kernel configuration to use iw tool (needed only if you want use iw)
+
:Enable "nl80211 testmode command" in kernel configuration
     [*] Networking support  --->
     [*] Networking support  --->
       --- Wireless
       --- Wireless
Line 32: Line 23:
     make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=<PATH_TO_FS> modules_install
     make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=<PATH_TO_FS> modules_install
 +
==To enable WLAN on the Panda Board Linux Kernel (>= v3.5)==
 +
* Changes in the Linux Configuration for Kernel Building:
 +
:Enable WLAN on Panda Board in the kernel configuration menu:
 +
    Device Drivers  --->
 +
        [*] Network device support  --->
 +
            [*]  Wireless LAN  --->
 +
                <M>  TI Wireless LAN support  --->
 +
                    <M>  TI wl12xx support
 +
                    {M}  TI wlcore support
 +
                        <M>    TI wlcore SDIO support
 +
:Enable "nl80211 testmode command" in kernel configuration
 +
    [*] Networking support  --->
 +
      --- Wireless
 +
            <M>  cfg80211 - wireless configuration API
 +
                [*]    nl80211 testmode command
==Firmware and NVS for the WLAN==
==Firmware and NVS for the WLAN==
* Clone the git tree : git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
* Clone the git tree : git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
-
     git clone git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
+
     git clone git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
* Copy the contents of "ti-connectivity" folder to /lib/firmware/ folder of the filesystem.
* Copy the contents of "ti-connectivity" folder to /lib/firmware/ folder of the filesystem.
Line 41: Line 47:
     Firmware and NVS for SoftAP:    wl1271-fw-ap.bin & wl1271-nvs-ap.bin
     Firmware and NVS for SoftAP:    wl1271-fw-ap.bin & wl1271-nvs-ap.bin
-
==Testing WLAN==
+
==Testing WLAN in Station mode==
TI WLAN interface name will show up as: "wlan0"
TI WLAN interface name will show up as: "wlan0"
Line 93: Line 99:
To disconnect from the AP:
To disconnect from the AP:
     iw dev wlan0 disconnect
     iw dev wlan0 disconnect
 +
 +
==Testing WLAN in SoftAP mode==
 +
Install hostapd and udhcpd packages in the filesystem ,if they are not present.
 +
    To install hostapd and udhpcd:
 +
        sudo apt-get install hostapd
 +
        sudo apt-get install udhcpd
 +
 +
Download [http://www.omappedia.org/images/8/87/SoftAP.tar.gz SoftAP.tar.gz] to the Filesystem and untar it.
 +
    mkdir /SoftAP
 +
    cd /SoftAP
 +
    tar xvzf SoftAP.tar.gz
 +
    cp udhcpd.conf /etc/.
 +
    sudo chmod 755 ap.sh
 +
 +
To bring up WLAN in AP mode:
 +
    If it is in station mode, stop wpa_supplicant
 +
    ./ap.sh sta_stop
 +
    Now start WLAN in SoftAP mode
 +
    ./ap.sh ap
 +
 +
The expected (typical) output is:
 +
    Starting AP
 +
    Configuration file: /tmp/hostapd.ap.conf
 +
    Using interface wlan0 with hwaddr de:ad:be:ef:00:00 and ssid 'blazetest'
 +
    Could not set DTIM period for kernel driver
 +
    Starting DHCP server
 +
    AP start complete
 +
 +
To list all the stations connected to our SoftAP:
 +
    hostapd_cli all_sta
 +
 +
To stop WLAN in SoftAP mode:
 +
    ./ap.sh ap_stop
 +
 +
'''NOTE:''' The default configuration of hostapd using the ap.sh is:
 +
    Interface: wlan0
 +
    BSSID : blazetest
 +
    Security : WPA2-AES
 +
    Password : password
 +
    Ip address: 10.0.0.1
 +
 +
===To change Security mode of SoftAP===
 +
Change the function '''generate-hostapd()''' in '''ap.sh''' file accordingly.
 +
Refer [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap-06.git;a=blob_plain;f=hostapd/hostapd.conf;hb=refs/heads/master hospad.conf] file for all parameters.
 +
 +
===To enable browsing on station when connected to SoftAP===
 +
 +
====Example Setup====
 +
 +
    wlan                      device                      ethernet
 +
    ---------------------------------------------------------------------------------
 +
    10.0.0.1                  Panda                        192.168.1.118    <===========> connected to your network 192.168.1.*
 +
          /\                (As Soft AP)
 +
          ||
 +
          ||
 +
          ||
 +
          ||
 +
          \/
 +
    10.0.0.20                  Panda                            not used
 +
                            (as Station)
 +
    ---------------------------------------------------------------------------------
 +
 +
====Modifications On Soft AP end:====
 +
 +
1.Before boot up  of Panda used as SoftAP, uncomment '''net.ipv4.ip_forward=1''' in '''/etc/systcl.conf''' file
 +
 +
2.Start the wlan in SoftAP mode
 +
 +
3.Change wlan0 subnet mask form 255.0.0.0 to 255.255.255.0
 +
    '''ifconfig wlan0 netmask 255.255.255.0'''
 +
 +
4. Copy the following script as nat_start to the Filesystem and execute it.
 +
 +
echo "Stopping firewall and allowing everyone..."
 +
iptables -F
 +
iptables -X
 +
iptables -t nat -F
 +
iptables -t nat -X
 +
iptables -t mangle -F
 +
iptables -t mangle -X
 +
iptables -P INPUT ACCEPT
 +
iptables -P FORWARD ACCEPT
 +
iptables -P OUTPUT ACCEPT
 +
echo "Enabling SNAT (MASQUERADE) functionality on eth0"
 +
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE
 +
iptables -A FORWARD -s 10.0.0.0/8 -d 0/0 -j ACCEPT
 +
 +
    '''chmod 755 nat_start'''
 +
    '''./nat_start'''
 +
 +
The expected (typical) output is:
 +
    Stopping firewall and allowing everyone...
 +
    Enabling SNAT (MASQUERADE) functionality on eth0
 +
 +
5. Now cross check whether SoftAP is able to browse a page or not
 +
    '''wget http://www.google.com'''
 +
The example output is:
 +
    --2011-08-03 15:04:15--  http://www.google.com/
 +
    Resolving xyzproxy.com... 10.5.7.45
 +
    Connecting to xyzproxy.com|10.5.7.45|:80... connected.
 +
    Proxy request sent, awaiting response... 302 Found
 +
    Location: http://www.google.co.in/ [following]
 +
    --2011-08-03 15:04:15--  http://www.google.co.in/
 +
    Connecting to xyzproxy.ti.com|10.5.7.45|:80... connected.
 +
    Proxy request sent, awaiting response... 200 OK
 +
    Length: unspecified [text/html]
 +
    Saving to: `index.html'
 +
   
 +
        [ <=>                                  ] 10,735      --.-K/s  in 0.04s
 +
   
 +
    2011-08-03 15:04:16 (297 KB/s) - `index.html' saved [10735]
 +
 +
====Modifications On Station end:====
 +
 +
1. Start wlan in Station mode and try to connect to the SoftAP.
 +
 +
NOTE: MAC address of wlan interface on Station and SoftAP must be different for successful connection
 +
    root@ubuntu-desktop:/mac802# '''ifconfig wlan0'''
 +
    wlan0    Link encap:Ethernet  HWaddr '''de:ad:be:ef:00:00'''
 +
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
 +
              RX packets:359 errors:0 dropped:0 overruns:0 frame:0
 +
              TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
 +
              collisions:0 txqueuelen:1000
 +
              RX bytes:85062 (85.0 KB)  TX bytes:29082 (29.0 KB)
 +
 +
IF they are same change, change it on station using the following commands and then try to connect
 +
    '''service network-manager stop'''
 +
    '''killall wpa_supplicant'''
 +
    '''ifconfig wlan0 hw ether 00:22:33:44:55:66'''
 +
    '''wpa_supplicant -Dnl80211 -iwlan0 -C/var/run -u &'''
 +
    '''service network-manager start'''
 +
 +
 +
2. After successful connection, Add a route so that everything is routed via wlan interface ( gateway = ip address of wlan interface on SoftAP end)
 +
    '''route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.0.0.1'''
 +
 +
Check whether route is added or not
 +
    root@ubuntu-desktop:/mac802# '''route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.0.0.1'''
 +
    root@ubuntu-desktop:/mac802# '''route'''
 +
    Kernel IP routing table
 +
    Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
 +
    10.0.0.0        *              255.255.255.0  U    0      0        0 wlan0
 +
    default        ubuntu-laptop.l 0.0.0.0        UG    0      0        0 wlan0
 +
   
 +
    '''Check whether you can ping to Ethernet interface of SoftAP from Station'''
 +
    root@ubuntu-desktop:/mac802# '''ping 192.168.1.118'''
 +
    PING 192.168.1.118 (192.168.1.118) 56(84) bytes of data.
 +
    64 bytes from 192.168.1.118: icmp_req=1 ttl=64 time=17.7 ms
 +
    64 bytes from 192.168.1.118: icmp_req=2 ttl=64 time=12.5 ms
 +
    ^C
 +
    --- 192.168.220.118 ping statistics ---
 +
    2 packets transmitted, 2 received, 0% packet loss, time 1001ms
 +
    rtt min/avg/max/mdev = 12.512/15.121/17.731/2.612 ms
 +
   
 +
    '''Check whether you can ping to any other device of your network from Station'''
 +
    root@ubuntu-desktop:/mac802# '''ping 192.168.1.184'''
 +
    PING 192.168.1.184 (192.168.1.184) 56(84) bytes of data.
 +
    64 bytes from 192.168.1.184: icmp_req=1 ttl=63 time=21.4 ms
 +
    64 bytes from 192.168.1.184: icmp_req=2 ttl=63 time=12.8 ms
 +
    ^C
 +
    --- 192.168.220.184 ping statistics ---
 +
    2 packets transmitted, 2 received, 0% packet loss, time 1002ms
 +
    rtt min/avg/max/mdev = 12.878/17.165/21.453/4.289 ms
 +
 +
3. Now Copy '''/etc/resolv.conf''' of SoftAP to the station and we can download the webpage on Station also
 +
 +
4. Now cross check whether station is able to browse a page or not
 +
    '''wget http://www.google.com'''
 +
The example output is:
 +
    --2011-08-03 15:04:16--  http://www.google.com/
 +
    Resolving xyzproxy.com... 10.5.7.45
 +
    Connecting to xyzproxy.com|10.5.7.45|:80... connected.
 +
    Proxy request sent, awaiting response... 302 Found
 +
    Location: http://www.google.co.in/ [following]
 +
    --2011-08-03 15:04:16--  http://www.google.co.in/
 +
    Connecting to xyzproxy.com|10.5.7.45|:80... connected.
 +
    Proxy request sent, awaiting response... 200 OK
 +
    Length: unspecified [text/html]
 +
    Saving to: `index.html'
 +
   
 +
        [ <=>                                  ] 10,735      --.-K/s  in 0.04s
 +
   
 +
    2011-08-03 15:04:16 (297 KB/s) - `index.html' saved [10735]
=To connect to a secured AP use wpa_supplicant=
=To connect to a secured AP use wpa_supplicant=
Line 100: Line 289:
     killall wpa_supplicant  
     killall wpa_supplicant  
2. Start with the following options:
2. Start with the following options:
 +
<pre>
     wpa_supplicant -Dwext -iwlan0 -C/var/run -u &
     wpa_supplicant -Dwext -iwlan0 -C/var/run -u &
-
            or
+
</pre>or
 +
<pre>
     wpa_supplicant -Dnl80211 -iwlan0 -C/var/run -u &
     wpa_supplicant -Dnl80211 -iwlan0 -C/var/run -u &
 +
</pre>
3. Use wpa_cli to connect to any network( open or secured)
3. Use wpa_cli to connect to any network( open or secured)
     wpa_cli -p/var/run
     wpa_cli -p/var/run
Line 139: Line 331:
     set_network 0 psk "key"
     set_network 0 psk "key"
     enable_network 0
     enable_network 0
 +
 +
==With WPS security==
 +
===Push Button Method===
 +
To connect to an AP with WPS security using push button method:
 +
 +
'''On the AP side:'''
 +
 +
Press the  push button
 +
 +
'''On the Station side:'''
 +
 +
wpa_cli -p/var/run
 +
wps_pbc
 +
 +
Now the station connects to the AP automatically
 +
 +
===Pin Method===
 +
To connect to an AP with WPS security using pin method:
 +
 +
'''On the Station side:'''
 +
wpa_cli -p/var/run
 +
wps_pin any
 +
49017007>
 +
This will generate a pin.(Here it is 49017007)
 +
 +
'''On the AP side:'''
 +
 +
Enter the pin generated on the client side in the AP.
 +
Now the station connects to the AP automatically
 +
 +
==With 802.1x security==
 +
===Procedure to install the certificate===
 +
1. Copy the certificate to the filesystem.
 +
 +
2. Change user to root ( sudo su).
 +
 +
3. Change to the directory to which certificate was copied.
 +
 +
4. OPne the terminal and start openssl
 +
<pre>
 +
openssl
 +
</pre>
 +
5. Type following commands to install CA certificate, client certificate and Private key.
 +
pkcs12 -in certificate.pfx -out cacert.pem -cacerts –nokeys
 +
pkcs12 -in certificate.pfx -out cert.pem -clcerts –nokeys
 +
pkcs12 -in certificate.pfx -out key.pem –nocerts
 +
 +
6. For key.pem enter an 8-digit key when asked for pem pass phrase.
 +
 +
'''NOTE 1:''' Ensure that a valid certificate is provided to you from the administrator in pkcs12 format.
 +
'''NOTE 2:''' here certificate name is: certificate.pfx. Please change it accordingly
 +
'''NOTE 3:''' Enter the key provided by administrator when asked for Import key.
 +
 +
===Procedure to connect to the AP in 802.1x security:===
 +
====From GUI====
 +
'''EXAMPLE: EAP-TLS'''
 +
 +
Click on AP that is secured with 802.1x EAP-TLS from nm-applet icon.
 +
Fill the following credentials in the popup window: '''Authentication required for wireless network'''
 +
'''Authentication :''' Select PEAP or TLS
 +
'''Identity :''' Provide as given by administrator
 +
'''Client certificate :''' browse and select the cert.pem file
 +
'''CA certificate :''' browse and select the cacert.pem file
 +
'''Private key :''' browse and select the key.pem file
 +
'''Private key password :''' 8-digit pem pass phrase entered while installing key.pem
 +
Click on Connect.
 +
 +
==Hidden Network==
 +
To connect to an AP in hidden mode (i.e. SSID not broadcasted):
 +
 +
Add the netwotk accordingly with the security.
 +
 +
Now set scan_ssid to 1 to that network_id using:
 +
    set_network <network_id> scan_ssid 1
 +
 +
=Ad-Hoc:=
 +
==Using iw==
 +
Remove the current interface(i.e in Station (STA)infrastructure mode and add Ad-Hoc (IBSS) mode using iw as below
 +
===open:===
 +
  #iw dev wlan0 del
 +
  #iw phy phy0 interface add wlan0 type ibss
 +
  #ifconfig wlan0 up
 +
  #iw dev wlan0 scan                                           
 +
  #iw dev wlan0 ibss join AdHocNetworkName 2412               
 +
To check the status
 +
  #iw dev wlan0 link                                           
 +
'''NOTE:'''
 +
If the scan results doesn't have an SSID="AdHocNetworkName", it will create the Ad-Hoc network with the same SSID.
 +
 +
We can join to it from other devices
 +
 +
==Using wpa_supplicant and wpa_cli==
 +
If you are using wpa_supplicant and wpa_cli, then please use the following commands:
 +
 +
===open:===
 +
  add_network
 +
  set_network 0 ssid "adhoc-open"
 +
  set_network 0 mode 1
 +
  set_network 0 frequency 2412
 +
  set_network 0 key_mgmt NONE
 +
  enable_network 0
 +
 +
===WEP40:===
 +
  add_network
 +
  set_network 0 ssid "adhoc-wep40"
 +
  set_network 0 mode 1
 +
  set_network 0 frequency 2412
 +
  set_network 0 key_mgmt NONE
 +
  set_network 0 wep_key0 1234567890
 +
  enable_network 0
 +
 +
===WEP128:===
 +
  add_network
 +
  set_network 0 ssid "adhoc-wep128"
 +
  set_network 0 mode 1
 +
  set_network 0 frequency 2412
 +
  set_network 0 key_mgmt NONE
 +
  set_network 0 wep_key0 12345678901234567890123456
 +
  enable_network 0
 +
 +
=P2P=
 +
To establish P2P connection between two wlan devices which support P2P:
 +
 +
Start wlan on both devices. In the below example we are using two Panda boards( named as Panda A & Panda B).
 +
 +
Now on Panda A start p2p group in 2.412 GHz
 +
  wpa_cli  p2p_group_add  freq=2412
 +
On Panda B try to connect
 +
  wpa_cli -iwlan0 p2p_find
 +
  wpa_cli -iwlan0 p2p_peers
 +
  wpa_cli p2p_connect <Panda A mac address> pbc join
 +
On Panda A accept the request
 +
  wpa_cli  wps_pbc
 +
 +
Assign the IP address to the wlan interfaces on both boards to do any data transfer.
 +
=Useful Links=
=Useful Links=
   
   
Line 177: Line 505:
:git clone git://w1.fi/srv/git/hostap.git
:git clone git://w1.fi/srv/git/hostap.git
 +
==Patches required to add WLAN support on the Panda Board (Linux Kernel version <= 2.6.38)==
 +
*Patch series required to enable WLAN on Panda are at [http://www.mail-archive.com/linux-omap@vger.kernel.org/msg44156.html Panda: Support for WLAN on WL127x]
 +
* Make sure you have the dependent patches for WLAN clock and HWMOD changes for MMC.<br />
 +
 +
::Please refer to the following links for WLAN clock patches: [https://patchwork.kernel.org/patch/546381/ Patch 1] and [https://patchwork.kernel.org/patch/546401/ Patch 2].<br />
 +
 +
::For original patches (of adaptation for HSMMC refer to): [http://www.mail-archive.com/linux-omap@vger.kernel.org/msg43464.html OMAP: HSMMC: HWMOD adaptation]
 +
 +
 +
[http://www.omappedia.org/wiki/OMAP_WiLink_Connectivity_Home Back to Connectivity Home Page]
 +
 +
[[Category:Connectivity]]
 +
[[Category:Ubuntu]]
[[Category:WLAN]]
[[Category:WLAN]]
[[Category:Wilink]]
[[Category:Wilink]]
-
[[Category:Ubuntu]]
 

Latest revision as of 21:01, 26 September 2012

Contents

[edit] mac80211 based WLAN driver: Description

Linux 2.6.39 RC1 kernel and up support WLAN in the 'station mode.' Soft access point (SoftAP) feature is going to be supported from Linux kernel 39 onwards. Alternatively, you can apply just the wireless patches to your present kernel. To do so, you can use compact wireless wl12xx.git to pull the SoftAP patches; and then apply them to your kernel code.

[edit] Procedure to build WLAN and test on Ubuntu FS

[edit] To enable WLAN on the Panda Board Linux Kernel (<= v3.4-rc7)

Enable WLAN on Panda Board in the kernel configuration menu:
   Device Drivers  ---> 
       [*] Network device support  --->
           [*]   Wireless LAN  ---> 
               <M>   TI wl12xx driver support  --->
                   <M>   TI wl12xx support  
                       <M>     TI wl12xx SDIO support
Enable "nl80211 testmode command" in kernel configuration
   [*] Networking support  --->
      --- Wireless
            <M>   cfg80211 - wireless configuration API
                [*]     nl80211 testmode command
Build the uImage and modules and copy them to the Filesystem
   make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage
   make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
   make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=<PATH_TO_FS> modules_install

[edit] To enable WLAN on the Panda Board Linux Kernel (>= v3.5)

Enable WLAN on Panda Board in the kernel configuration menu:
   Device Drivers  ---> 
       [*] Network device support  --->
           [*]   Wireless LAN  ---> 
               <M>   TI Wireless LAN support  --->
                   <M>   TI wl12xx support
                   {M}   TI wlcore support
                       <M>     TI wlcore SDIO support
Enable "nl80211 testmode command" in kernel configuration
   [*] Networking support  --->
      --- Wireless
            <M>   cfg80211 - wireless configuration API
                [*]     nl80211 testmode command

[edit] Firmware and NVS for the WLAN

   git clone git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
   Firmware and NVS for station:     wl1271-fw.bin  & wl1271-nvs.bin
   Firmware and NVS for SoftAP:    wl1271-fw-ap.bin & wl1271-nvs-ap.bin

[edit] Testing WLAN in Station mode

TI WLAN interface name will show up as: "wlan0"

[edit] To load WLAN modules

Check the list of modules loaded by using:

   lsmod

The modules required are: wl12xx.ko and wl12xx_sdio.ko.

If they are not present, load them:

   insmod /lib/modules/`uname -r`/kernel/net/wireless/cfg80211.ko
   insmod /lib/modules/`uname -r`/kernel/net/mac80211/mac80211.ko
   insmod /lib/modules/`uname -r`/kernel/drivers/net/wireless/wl12xx/wl12xx.ko
   insmod /lib/modules/`uname -r`/kernel/drivers/net/wireless/wl12xx/wl12xx_sdio.ko

To verify the drivers loaded successfully:

   tail -3 /var/log/kern.log

The expected (typical) output is:

   cfg80211: Calling CRDA to update world regulatory domain
   wl1271: loaded
   wl1271: initialized

[edit] To bring WLAN interface UP

To list all the interfaces that are up:

   ifconfig 

If the interface is not listed, check all the interfaces available:

   ifconfig -a

Check whether wlan0 has a valid MAC address. If not assign it:

   ifconfig wlan0 hw ether 00:22:33:44:55:66

Bring up the interface:

   ifconfig wlan0 up

To verify the drivers loaded successfully:

   tail -1 /var/log/kern.log 

The expected (typical) output is:

   wl1271: firmware booted (Rev 6.1.0.0.343)

[edit] To Connect or Disconnect to an AP

Use "iwlist" or "iw" to scan.

   iwlist wlan0 scan
        or
   iw dev wlan0 scan

Connect to an AP listed in open mode:

   iwconfig wlan0 essid "AP_NAME"
         or
   iw wlan0 connect AP_NAME

If AP has the DHCP capability, get the IP address:

   dhclient wlan0
      or assign it using: 
   ifconfig wlan0 xx.xx.xx.xx netmask 255.255.255.0

To disconnect from the AP:

   iw dev wlan0 disconnect

[edit] Testing WLAN in SoftAP mode

Install hostapd and udhcpd packages in the filesystem ,if they are not present.

   To install hostapd and udhpcd:
       sudo apt-get install hostapd
       sudo apt-get install udhcpd

Download SoftAP.tar.gz to the Filesystem and untar it.

   mkdir /SoftAP
   cd /SoftAP
   tar xvzf SoftAP.tar.gz
   cp udhcpd.conf /etc/.
   sudo chmod 755 ap.sh

To bring up WLAN in AP mode:

   If it is in station mode, stop wpa_supplicant
   ./ap.sh sta_stop
   Now start WLAN in SoftAP mode
   ./ap.sh ap

The expected (typical) output is:

   Starting AP
   Configuration file: /tmp/hostapd.ap.conf
   Using interface wlan0 with hwaddr de:ad:be:ef:00:00 and ssid 'blazetest'
   Could not set DTIM period for kernel driver
   Starting DHCP server
   AP start complete

To list all the stations connected to our SoftAP:

   hostapd_cli all_sta

To stop WLAN in SoftAP mode:

   ./ap.sh ap_stop

NOTE: The default configuration of hostapd using the ap.sh is:

   Interface: wlan0
   BSSID : blazetest
   Security : WPA2-AES 
   Password : password
   Ip address: 10.0.0.1

[edit] To change Security mode of SoftAP

Change the function generate-hostapd() in ap.sh file accordingly. Refer hospad.conf file for all parameters.

[edit] To enable browsing on station when connected to SoftAP

[edit] Example Setup

   wlan                       device                      ethernet
   ---------------------------------------------------------------------------------
   10.0.0.1                   Panda                        192.168.1.118    <===========> connected to your network 192.168.1.*
         /\                 (As Soft AP) 
         ||
         ||
         ||
         ||
         \/
   10.0.0.20                  Panda                            not used
                           (as Station)
   ---------------------------------------------------------------------------------

[edit] Modifications On Soft AP end:

1.Before boot up of Panda used as SoftAP, uncomment net.ipv4.ip_forward=1 in /etc/systcl.conf file

2.Start the wlan in SoftAP mode

3.Change wlan0 subnet mask form 255.0.0.0 to 255.255.255.0

   ifconfig wlan0 netmask 255.255.255.0

4. Copy the following script as nat_start to the Filesystem and execute it.

echo "Stopping firewall and allowing everyone..."
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
echo "Enabling SNAT (MASQUERADE) functionality on eth0"
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE
iptables -A FORWARD -s 10.0.0.0/8 -d 0/0 -j ACCEPT
   chmod 755 nat_start
   ./nat_start

The expected (typical) output is:

   Stopping firewall and allowing everyone...
   Enabling SNAT (MASQUERADE) functionality on eth0

5. Now cross check whether SoftAP is able to browse a page or not

   wget http://www.google.com

The example output is:

   --2011-08-03 15:04:15--  http://www.google.com/
   Resolving xyzproxy.com... 10.5.7.45
   Connecting to xyzproxy.com|10.5.7.45|:80... connected.
   Proxy request sent, awaiting response... 302 Found
   Location: http://www.google.co.in/ [following]
   --2011-08-03 15:04:15--  http://www.google.co.in/
   Connecting to xyzproxy.ti.com|10.5.7.45|:80... connected.
   Proxy request sent, awaiting response... 200 OK
   Length: unspecified [text/html]
   Saving to: `index.html'
   
       [ <=>                                   ] 10,735      --.-K/s   in 0.04s
   
   2011-08-03 15:04:16 (297 KB/s) - `index.html' saved [10735]

[edit] Modifications On Station end:

1. Start wlan in Station mode and try to connect to the SoftAP.

NOTE: MAC address of wlan interface on Station and SoftAP must be different for successful connection

   root@ubuntu-desktop:/mac802# ifconfig wlan0
   wlan0     Link encap:Ethernet  HWaddr de:ad:be:ef:00:00
             UP BROADCAST MULTICAST  MTU:1500  Metric:1
             RX packets:359 errors:0 dropped:0 overruns:0 frame:0
             TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:1000
             RX bytes:85062 (85.0 KB)  TX bytes:29082 (29.0 KB)

IF they are same change, change it on station using the following commands and then try to connect

   service network-manager stop
   killall wpa_supplicant
   ifconfig wlan0 hw ether 00:22:33:44:55:66
   wpa_supplicant -Dnl80211 -iwlan0 -C/var/run -u &
   service network-manager start


2. After successful connection, Add a route so that everything is routed via wlan interface ( gateway = ip address of wlan interface on SoftAP end)

   route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.0.0.1

Check whether route is added or not

   root@ubuntu-desktop:/mac802# route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.0.0.1
   root@ubuntu-desktop:/mac802# route
   Kernel IP routing table
   Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
   10.0.0.0        *               255.255.255.0   U     0      0        0 wlan0
   default         ubuntu-laptop.l 0.0.0.0         UG    0      0        0 wlan0
   
   Check whether you can ping to Ethernet interface of SoftAP from Station
   root@ubuntu-desktop:/mac802# ping 192.168.1.118
   PING 192.168.1.118 (192.168.1.118) 56(84) bytes of data.
   64 bytes from 192.168.1.118: icmp_req=1 ttl=64 time=17.7 ms
   64 bytes from 192.168.1.118: icmp_req=2 ttl=64 time=12.5 ms
   ^C
   --- 192.168.220.118 ping statistics ---
   2 packets transmitted, 2 received, 0% packet loss, time 1001ms
   rtt min/avg/max/mdev = 12.512/15.121/17.731/2.612 ms
   
   Check whether you can ping to any other device of your network from Station
   root@ubuntu-desktop:/mac802# ping 192.168.1.184
   PING 192.168.1.184 (192.168.1.184) 56(84) bytes of data.
   64 bytes from 192.168.1.184: icmp_req=1 ttl=63 time=21.4 ms
   64 bytes from 192.168.1.184: icmp_req=2 ttl=63 time=12.8 ms
   ^C
   --- 192.168.220.184 ping statistics ---
   2 packets transmitted, 2 received, 0% packet loss, time 1002ms
   rtt min/avg/max/mdev = 12.878/17.165/21.453/4.289 ms

3. Now Copy /etc/resolv.conf of SoftAP to the station and we can download the webpage on Station also

4. Now cross check whether station is able to browse a page or not

   wget http://www.google.com

The example output is:

   --2011-08-03 15:04:16--  http://www.google.com/
   Resolving xyzproxy.com... 10.5.7.45
   Connecting to xyzproxy.com|10.5.7.45|:80... connected.
   Proxy request sent, awaiting response... 302 Found
   Location: http://www.google.co.in/ [following]
   --2011-08-03 15:04:16--  http://www.google.co.in/
   Connecting to xyzproxy.com|10.5.7.45|:80... connected.
   Proxy request sent, awaiting response... 200 OK
   Length: unspecified [text/html]
   Saving to: `index.html'
   
       [ <=>                                   ] 10,735      --.-K/s   in 0.04s
   
   2011-08-03 15:04:16 (297 KB/s) - `index.html' saved [10735]

[edit] To connect to a secured AP use wpa_supplicant

1. First kill the supplicant if it is present:

   sudo su
   service network-manager stop
   killall wpa_supplicant 

2. Start with the following options:

    wpa_supplicant -Dwext -iwlan0 -C/var/run -u &
or
    wpa_supplicant -Dnl80211 -iwlan0 -C/var/run -u &

3. Use wpa_cli to connect to any network( open or secured)

   wpa_cli -p/var/run

[edit] No security (OPEN)

To connect to an AP without security:

   add_network
   set_network 0 ssid "name of AP"
   set_network 0 key_mgmt NONE
   enable_network 0

[edit] With WEP security

To connect to an AP with WEP security:

   add_network
   set_network 0 ssid "name of AP"
   set_network 0 key_mgmt NONE
   set_network 0 wep_key0 <key>
   enable_network 0

NOTE: WEP key must be 10 or 26 characters long according to whether it is WEP40 or WEP128 respectively.

[edit] With WPA-TKIP security

To connect to an AP with WPA1 security:

   add_network
   set_network 0 ssid "name of AP"
   set_network 0 key_mgmt WPA-PSK
   set_network 0 pairwise TKIP
   set_network 0 psk "key"
   enable_network 0

[edit] With WPA-AES-CCMP security

To connect to an AP with WPA2 security:

   add_network
   set_network 0 ssid "name of AP"
   set_network 0 key_mgmt WPA-PSK
   set_network 0 pairwise CCMP
   set_network 0 psk "key"
   enable_network 0

[edit] With WPS security

[edit] Push Button Method

To connect to an AP with WPS security using push button method:

On the AP side:

Press the push button

On the Station side:

wpa_cli -p/var/run
wps_pbc

Now the station connects to the AP automatically

[edit] Pin Method

To connect to an AP with WPS security using pin method:

On the Station side:

wpa_cli -p/var/run
wps_pin any
49017007>

This will generate a pin.(Here it is 49017007)

On the AP side:

Enter the pin generated on the client side in the AP. Now the station connects to the AP automatically

[edit] With 802.1x security

[edit] Procedure to install the certificate

1. Copy the certificate to the filesystem.

2. Change user to root ( sudo su).

3. Change to the directory to which certificate was copied.

4. OPne the terminal and start openssl

 openssl

5. Type following commands to install CA certificate, client certificate and Private key.

pkcs12 -in certificate.pfx -out cacert.pem -cacerts –nokeys 
pkcs12 -in certificate.pfx -out cert.pem -clcerts –nokeys 
pkcs12 -in certificate.pfx -out key.pem –nocerts

6. For key.pem enter an 8-digit key when asked for pem pass phrase.

NOTE 1: Ensure that a valid certificate is provided to you from the administrator in pkcs12 format. NOTE 2: here certificate name is: certificate.pfx. Please change it accordingly NOTE 3: Enter the key provided by administrator when asked for Import key.

[edit] Procedure to connect to the AP in 802.1x security:

[edit] From GUI

EXAMPLE: EAP-TLS

Click on AP that is secured with 802.1x EAP-TLS from nm-applet icon. Fill the following credentials in the popup window: Authentication required for wireless network

Authentication : Select PEAP or TLS
Identity : Provide as given by administrator 
Client certificate : browse and select the cert.pem file 
CA certificate : browse and select the cacert.pem file 
Private key : browse and select the key.pem file 
Private key password : 8-digit pem pass phrase entered while installing key.pem 

Click on Connect.

[edit] Hidden Network

To connect to an AP in hidden mode (i.e. SSID not broadcasted):

Add the netwotk accordingly with the security.

Now set scan_ssid to 1 to that network_id using:

   set_network <network_id> scan_ssid 1

[edit] Ad-Hoc:

[edit] Using iw

Remove the current interface(i.e in Station (STA)infrastructure mode and add Ad-Hoc (IBSS) mode using iw as below

[edit] open:

  #iw dev wlan0 del
  #iw phy phy0 interface add wlan0 type ibss
  #ifconfig wlan0 up
  #iw dev wlan0 scan                                            
  #iw dev wlan0 ibss join AdHocNetworkName 2412                 

To check the status

  #iw dev wlan0 link                                             

NOTE: If the scan results doesn't have an SSID="AdHocNetworkName", it will create the Ad-Hoc network with the same SSID.

We can join to it from other devices

[edit] Using wpa_supplicant and wpa_cli

If you are using wpa_supplicant and wpa_cli, then please use the following commands:

[edit] open:

  add_network
  set_network 0 ssid "adhoc-open"
  set_network 0 mode 1
  set_network 0 frequency 2412
  set_network 0 key_mgmt NONE
  enable_network 0

[edit] WEP40:

  add_network
  set_network 0 ssid "adhoc-wep40"
  set_network 0 mode 1
  set_network 0 frequency 2412
  set_network 0 key_mgmt NONE
  set_network 0 wep_key0 1234567890
  enable_network 0

[edit] WEP128:

  add_network
  set_network 0 ssid "adhoc-wep128"
  set_network 0 mode 1
  set_network 0 frequency 2412
  set_network 0 key_mgmt NONE
  set_network 0 wep_key0 12345678901234567890123456
  enable_network 0

[edit] P2P

To establish P2P connection between two wlan devices which support P2P:

Start wlan on both devices. In the below example we are using two Panda boards( named as Panda A & Panda B).

Now on Panda A start p2p group in 2.412 GHz

  wpa_cli  p2p_group_add  freq=2412

On Panda B try to connect

  wpa_cli -iwlan0 p2p_find
  wpa_cli -iwlan0 p2p_peers
  wpa_cli p2p_connect <Panda A mac address> pbc join

On Panda A accept the request

  wpa_cli  wps_pbc

Assign the IP address to the wlan interfaces on both boards to do any data transfer.

[edit] Useful Links

Mainline kernel:

https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Luca kernel:

https://git.kernel.org/?p=linux/kernel/git/luca/wl12xx.git;a=summary
git clone git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git

Linux Firmware:

https://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=summary
git clone git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git

Ti-Utils:

https://github.com/gxk/ti-utils
git clone git://github.com/gxk/ti-utils.git

iw tool:

http://git.sipsolutions.net/?p=iw.git
git clone git://git.sipsolutions.net/iw.git

latest wpa_supplicant & hostap:

http://hostap.epitest.fi
git clone git://w1.fi/srv/git/hostap.git

[edit] Patches required to add WLAN support on the Panda Board (Linux Kernel version <= 2.6.38)

Please refer to the following links for WLAN clock patches: Patch 1 and Patch 2.
For original patches (of adaptation for HSMMC refer to): OMAP: HSMMC: HWMOD adaptation


Back to Connectivity Home Page

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox