Home Contact us Terms & conditions Shopping cart Surplus sales


Linux SoM


Wi-Fi USB adapters

This article explains how to use some USB Wi-Fi adapters on your Acme Boards

The USB Wi-Fi adapter tested, based on Realtek 8188su or 8188csu chips, are:

The USB Wi-Fi adapter tested, based on Atheros chip, is:

Insert the USB dongle

Insert the Wi-Fi USB adapter on your Acme Board USB port. These messages should appear on the debug port or by typing dmesg command:

USB miniadapter message

r8712u: DriverVersion: v7_0.20100831
r8712u: register rtl8712_netdev_ops to netdev_ops
r8712u: USB_SPEED_LOW with 4 endpoints
r8712u: Boot from EFUSE: Autoload OK
r8712u: CustomerID = 0x0000
r8712u: MAC Address from efuse = 00:1f:1f:75:28:93

TP-LINK TL-WN722N USB adapter message

usb 1-2: ath9k_htc: USB layer deinitialized
usb 1-2: new high speed USB device number 4 using atmel-ehci
usb 1-2: New USB device found, idVendor=0cf3, idProduct=9271
usb 1-2: New USB device strings: Mfr=16, Product=32, SerialNumber=48
usb 1-2: Product: USB2.0 WLAN
usb 1-2: Manufacturer: ATHEROS
usb 1-2: SerialNumber: 12345
usb 1-2: ath9k_htc: Transferred FW: ar9271.fw, size: 51312
ath9k_htc 1-2:1.0: ath9k_htc: HTC initialized with 33 credits
ath9k_htc 1-2:1.0: wlan0: Features changed: 0x00004800 -> 0x00004000
ieee80211 phy1: Atheros AR9271 Rev:1
usb 1-2: ath9k_htc: USB layer initialized

If you don't obtain these messages you will probably have to update Kernel configuration (see the Kernel configuration below).

When you get the right messages try to type this command:

debarm:~# cat /proc/net/wireless 
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
 wlan0: 0000    0.    0.    0.       0      0      0      0      0        0

Install the Wireless-tools

To configure and use the Wi-Fi adapter you need to install the Wireless tools for Linux, a package of Linux commands intended to support and facilitate the configuration of wireless devices.

To install this package type:

debarm:~# apt-get update
debarm:~# apt-get install wireless-tools

When finished type:

debarm:~# iwconfig
lo        no wireless extensions.
 
eth0      no wireless extensions.
 
wlan0     unassociated  Nickname:"rtl_wifi"
          Mode:Auto  Access Point: Not-Associated   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

which provides info about the wireless extensions of each network adapter (in this case wlan0).

Network configuration

As a first configuration example, we'll show you how to get access to an open Wi-Fi LAN. Edit the file /etc/network/interfaces and add these lines:

auto wlan0
iface wlan0 inet dhcp
  wireless-essid [your_essid] 
  wireless-mode managed 

Restart the network services typing:

debarm:~# /etc/init.d/networking restart
...
Listening on LPF/wlan0/5c:d9:98:a7:3a:fe                                        
Sending on   LPF/wlan0/5c:d9:98:a7:3a:fe                                        
Sending on   Socket/fallback                                                    
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5                     
DHCPOFFER from 192.168.1.1                                                      
DHCPREQUEST on wlan0 to 255.255.255.255 port 67                                 
DHCPACK from 192.168.1.1                                                        
bound to 192.168.1.2 -- renewal in 8171 seconds.                                
done.    
debarm:~# ifconfig
...
wlan0     Link encap:Ethernet  HWaddr 5c:d9:98:a7:3a:fe                         
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0        
          inet6 addr: fe80::5ed9:98ff:fea7:3afe/64 Scope:Link                   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                    
          RX packets:4057 errors:0 dropped:0 overruns:0 frame:0                 
          TX packets:327 errors:0 dropped:0 overruns:0 carrier:0                
          collisions:0 txqueuelen:1000                                          
          RX bytes:287147 (280.4 KiB)  TX bytes:21864 (21.3 KiB)         

Connect to a WEP-protected LAN

Edit the file /etc/network/interfaces and set wireless-key:

auto wlan0
iface wlan0 inet dhcp
  wireless-essid [your_essid]
  wireless-key [your_wep_key]

Restart the network services as in the previous section.

Install the wpa_supplicant for encrypt access

Wpa supplicant is a software implementation of an IEEE 802.11i supplicant for Linux that manages the authentication on the Wi-Fi link.

To install these packages type:

debarm:~# apt-get update
debarm:~# apt-get install wpasupplicant

Now add in the file /etc/network/interfaces the configuration for the wlan0 network adapter to add Wi-Fi Protected Access (WPA) or Wi-Fi Protected Access II (WPA2).

auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid [your_essid]
wpa-ap-scan 2
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk [your_hex_key]

Change the fields [your_essid] with the SSID of your access point and [your_hex_key] with the WPA-PSK key.

To generate a WPA-PSK key from WPA ascii key use this command:

wpa_passphrase [your_essid] [your_ascii_key]

For example on my access point called "acme" that uses the ascii key "netusg20" the command is this:

debarm:/etc/init.d# wpa_passphrase acme netusg20
network={
        ssid="acme"
        #psk="netusg20"
        psk=38c309a773a6c936c31aeb8bcb5bc44d60539715524e77464759f29095bfc1f3
}

Copying the psk code the /etc/network/interfaces file becomes:

auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid acme
wpa-ap-scan 2
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk 38c309a773a6c936c31aeb8bcb5bc44d60539715524e77464759f29095bfc1f3

Now type:

debarm:~# /etc/init.d/networking restart

After a while if the dhcp are working well you will obtain your interface up. You can also detach the eth0 lan cable to try to access your FOXG20 directly from the Wi-Fi link.

debarm:~# iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:"acme"  Nickname:"rtl_wifi"
          Mode:Managed  Frequency:2.447 GHz  Access Point: 00:21:29:69:C2:D8   
          Bit Rate:54 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Kernel configuration

If this tutorial doesn't work on your Acme Board probably you have to change the Kernel configuration and compile it as explained on these articles:

The access to the Kernel configuration panel and enable the following items:

For the D-Link/Realtek mini USB adapter

Device Drivers  --->
  [*] USB support  ---> 
    <*> USB Wireless Device Management support

You also have to verify whether the usb device ID detected by the FOX Board is known by the Kernel.

To do that type the command:

debarm:~# lsusb                                                                 
Bus 001 Device 002: ID 0bda:8171 Realtek Semiconductor Corp. RTL8188SU 802.11n r
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

then get the id 0bda:8171 and check if it is listed into the file drivers/staging/rtl8712/usb_intf.c if not apply a patch like this and recompile the Kernel uImage:

diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_in
index 21ce2af..bfa5458 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -49,6 +49,11 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf
 static struct usb_device_id rtl871x_usb_id_tbl[] = {
 
 /* RTL8188SU */
+       /* Digitus */
+       {USB_DEVICE(0x0BDA, 0x8171)},
+       /* Digicom */
+       {USB_DEVICE(0x0BDA, 0x8171)},
+       {USB_DEVICE(0x0BDA, 0x8176)},
        /* Realtek */
        {USB_DEVICE(0x0BDA, 0x8171)},
        {USB_DEVICE(0x0bda, 0x8173)},

For the TP-LINK/Atheros USB adapter

Device Drivers  --->
  [*] USB support  ---> 
    <*> USB Wireless Device Management support

Device Drivers  --->
    [*] Network device support  --->
        [*]   Wireless LAN  ---> 
            <*>   Atheros Wireless Cards  ---> 
                <*>   Atheros HTC based wireless cards support 

Related links

Credits

Thanks to Vincent Jacques for his contributions to this article.


DWA-131 : D-Link Wireless N Nano Adapter EURO 24.00

D-Link USB WiFi mini adapter.

The packaging could be different than in photo.

How to use it | Product info


TL-WN722NC : TP-Link TL-WN722NC 150Mbps High Gain Wireless USB Adapter EURO 18.00

TP-Link wi-fi adapter with high gain antenna

How to use it




Acme Systems srl
Via Aldo Moro 53 - 00055 Ladispoli (RM) - Italy
P.IVA/C.F. 08114831004
Tel +39.06.99.12.187 - Fax +39.06.622.765.31
http://www.acmesystems.it -
Iscritta al Registro delle Imprese di Roma al n. 08114831004


Atmel© Certified Partner

Documentation Terms of Use
Acme Systems provides this documentation "as is" without warranty or guarantees of any kind. The mantainer of this site (Sergio Tanzilli), has gone to a great deal of effort into making this documentation as correct as possible. Acme Systems doesn't provide any direct support for the Open Source preinstalled software but provides, through these pages and forum posts, all the information required to obtain the sources, install, use and update the Open Source softwares runnable on the FOX Board, NetusG20, AriaG25 and Terra platforms. Please note that all the preinstalled softwares, used on the Acme Systems products, are Open Source and you will have to check the license terms provided (usually the GPL) by each author before using it in any commercial or non-commercial product, by yourself. Before sending emails or calling the Acme staff here are our contacts please note that WE ARE MAINLY HARDWARE DESIGNERS and NOT LINUX GURUS so could be better to post your questions directly to the forum listed below to be sure that all the contributors of this site and the large software developers community will read and reply to your questions.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License