Sunday, July 29, 2012

Arch Linux Raspberry PI Wirelss USB Edimax EW-7811Um

I got an Edimax EW-7811Um a few days ago on eBay from Peats, actually. Nice, really small. Just what I wanted for a wireless project I have for the Raspberry PI (RPI) running Arch Linux.

I had a wrestle with it for a few hours, trying to get it working.

I was able to get it working using a number of different sources.

Here all the sources are combined into one Recipe, that works.

I have two RPIs and used this method to configure the card on the second RPI, after the first one was working. so I know it works

I started with a fully upto date OS, e.g. pacman -Syu will do this.


The life saver link was Edimax EW-7811Un USB-Wifi adapter.

Here is what I did:

Download and compile the drivers
 
1. wget http://myplugbox.com/rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622.tar.gz

Get the driver

2. tar xzf rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622.tar.gz

Extract the doings

3. cd rtl8188C_8192C_usb_linux_v3.4.3_4369.20120622

Change to the directory

4. nano Makefile

Change KVER to what the current version is. It's currently set to: KVER := 3.1.9-31-ARCH+

I changed mine to 3.1.9-33-ARCH+

If in doubt use 'uname -a' to get the current kernel version.

5. make

This compiles the driver and takes about 10+ minutes

6. cp 8192cu.ko /usr/lib/modules/extramodules-3.1.9--raspberrypi/

Copy the new driver to a place that will be used to load it.

7. depmod -a

This wil find the new modules and write them to a file called something. I don't care.

8. sync ; reboot

9. Log back in and run lsmod

You should see the '8192cu' listed

So far, so good.

Now to configure for automatic loading of the driver and settings.

10. nano /etc/rc.conf and modify the line

MODULES=(8192cu !rtl8192cu)

This stops the rtl8192cu module that does not work for the USB Device and loads the 8192cu

11. nano /etc/rc.local

This makes sure that the required  programs are run at boot time.

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant_special.conf -i wlan0
ifconfig wlan0 192.168.22.132 255.255.255.0
route add default gw 192.168.22.1

12. nano /etc/wpa_supplicant/wpa_supplicant_special.conf

This is all that is needed for wpa_supplicant. The other default settings are OK, I think.

# WPA-Personal(PSK) with TKIP and enforcement for frequent PTK rekeying
network={
        ssid="ESSIDtoUse"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="secret agent password in clear text or Hex"
        wpa_ptk_rekey=600
}

So far so good again.

13. sync ; reboot

14. Log back in

It might take a few minutes longer to login, as there are two network connection and the RPI may be getting confused.

If you run 'ifconfig', you should see the wlan0 card listed.

15. nano /etc/rc.conf

Comment out the Ethernet settings, so that the wire connection is no longer used.

#interface=eth0
#address=192.168.22.130
#netmask=255.255.255.0
#broadcast=192.168.22.255
#gateway=192.168.22.1

16. sync ; reboot

17. Log back in using the new Wireless IP Address.

Job done. Time for a beer and a quiet smirk.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Or you can just install the build tools:
    pacman -S base-devel
    and make the file...

    ReplyDelete