Monday, August 6, 2012

WiFi dongle on Raspberry Pi


A little guide how to use Linksys WUSB54GC WiFi dongle on Raspberry Pi (Raspbian “wheezy” images). The dongle is pretty old but I used it just for the test :)

(1) You need self-powered USB hub!
(2) Plug the dongle in the hub:

pi@raspberrypi:~$ dmesg
[  111.915950] usb 1-1.3.2: new high speed USB device number 5 using dwc_otg
[  112.216207] usb 1-1.3.2: New USB device found, idVendor=13b1, idProduct=0020
[  112.216240] usb 1-1.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  112.216261] usb 1-1.3.2: Product: Compact Wireless-G USB Adapter
[  112.216290] usb 1-1.3.2: Manufacturer: Cisco-Linksys
[  112.311511] cfg80211: Calling CRDA to update world regulatory domain
[  112.495964] usb 1-1.3.2: reset high speed USB device number 5 using dwc_otg
[  112.978042] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[  112.981551] Registered led device: rt73usb-phy0::radio
[  112.982146] Registered led device: rt73usb-phy0::assoc
[  112.982727] Registered led device: rt73usb-phy0::quality
[  112.987435] usbcore: registered new interface driver rt73usb

We can also see the drivers are loaded:

pi@raspberrypi:~$ lsmod
Module                  Size  Used by
...
rt73usb                 23490  0
rt2x00usb              12077  1 rt73usb
rt2x00lib              43890  2 rt2x00usb,rt73usb
mac80211              253889  2 rt2x00lib,rt2x00usb
cfg80211              180459  2 mac80211,rt2x00lib


(3) wlan0 interface is automatically created:

pi@raspberrypi:~$ ifconfig
wlan0     Link encap:Ethernet  HWaddr 00:1d:7e:11:c4:56
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


(4) To connect automatically to WiFi AP add this to /etc/network/interfaces:

auto wlan0
iface wlan0 inet dhcp
  wpa-ssid <AP-SSID>
  wpa-psk <KEY>


(5) Restart networking:

pi@raspberrypi:~$ sudo /etc/init.d/networking restart
Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces ... (warning).
Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/00:1d:7e:11:c4:56
Sending on   LPF/wlan0/00:1d:7e:11:c4:56
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.32.1
DHCPACK from 192.168.32.1
bound to 192.168.32.104 -- renewal in 32936 seconds.
done.


Done!

pi@raspberrypi:~$ dmesg
[  374.243090] wlan0: authenticate with 00:b0:0c:4f:25:10 (try 1)
[  374.244913] wlan0: authenticated
[  374.307729] wlan0: associate with 00:b0:0c:4f:25:10 (try 1)
[  374.312512] wlan0: RX AssocResp from 00:b0:0c:4f:25:10 (capab=0x411 status=0 aid=1)
[  374.312540] wlan0: associated

pi@raspberrypi:~$ ifconfig
wlan0     Link encap:Ethernet  HWaddr 00:1d:7e:11:c4:56
          inet addr:192.168.32.104  Bcast:192.168.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:51 errors:0 dropped:0 overruns:0 frame:0
          TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10652 (10.4 KiB)  TX bytes:4726 (4.6 KiB)


Try some ping:

pi@raspberrypi:~$ ping google.com
PING google.com (209.85.148.101) 56(84) bytes of data.
64 bytes from fra07s07-in-f101.1e100.net (209.85.148.101): icmp_req=1 ttl=56 time=34.7 ms
64 bytes from fra07s07-in-f101.1e100.net (209.85.148.101): icmp_req=2 ttl=56 time=46.4 ms
64 bytes from fra07s07-in-f101.1e100.net (209.85.148.101): icmp_req=3 ttl=56 time=45.8 ms
...

So for the test I left it pinging for some time. Haven't seen any issues till now :)

Next step: To avoid using self-powered hub find WiFi dongle with lower power consumption... :/
-----------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment