I bought Edimax EW-7811Un adapter for my Pi - small factor, b/g/n type, so why not... especially when vendor says it provides Linux drivers (wohoo!). Sadly as it turns out, compiling drivers on x86 or x64 and ARM architectures can be totally different experience - especially with Raspberry Pi being in it's software infancy. In all seriousness - Pi is for those that like to solve problems (at least at the current stage), but the community works hard to catch up very quickly - great stuff!
The wireless adapter
Under the hood, EW-7811Un runs Realtek's rtl8192cu chipset. Kernel module for this chipset is actually included in Debian 6 image (19-04-2012) distributed via Raspberry Pi website, but it will not work with the card. This is for device with USB ID 7392:7811 - there may be other hardware revisions that will.
Actually after the whole procedure described here, running lsusb shows totally different chipset
EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]so I'm not sure which one it really is... and to be fair, I don't care - it works :-)
Debian image is really nice to start with but it has some issues. Maybe I'm purist but working for some time with ARM devices I learned to value resources they offer. I was a bit surprised how many unneeded things were turned on by default and that SSH was actually disabled. We will get those things fixed a bit further down...
Putting the bits together
I had to change the procedure a bit, because the whole system wasn't very stable. I was getting a lot of kernel panics and segfaults that were causing Pi to freeze (read hang up) all the time. First suspicion was power supply (I use iPhone PSU - it's rated 5V/1A) but it turned out to be firmware/kernel issue it seems, so we start with fixing it first. Some of the steps below (especially firmware part) were found on the Raspberry Pi forums in thread about XBMC so kudos to their authors - you guys rock!
- Start with debian6-19-04-2012 image
- Download the latest firmware from GitHub - I used revision a8f8d24
- Copy all files from firmware/boot to /boot
- Replace /opt/vc with firmware/opt/vc
- Replace /lib/modules/3.1.9+ with firmware/modules/3.1.9+
- Download the latest tools from GitHub - I used revision 3aba47b
- Copy arm-bcm2708/linux-x86/arm-bcm2708-linux-gnueabi/sys-root/lib/libstdc++.so.6.0.14 from https://github.com/raspberrypi/tools to /usr/lib and run: sudo ldconfig
- Download the compiled driver module from here, unpack and move to /lib/modules/3.1.9+/kernel/net/wireless/
- Run: sudo depmod -a
- We need to block the kernel module that comes with Debian image - edit /etc/modprobe.d/blacklist.conf and add the following line: blacklist rtl8192cu
- We want the new module to always load on boot, regardless of hardware being present or not - edit /etc/modules and add the following line: 8192cu
- Configure wpa_supplicant - edit /etc/wpa_supplicant.conf:
# to get encoded PSK run: wpa_passphrase <ESSID>
psk=<psk returned by wpa_passphrase>
- Make interface come up automatically - edit /etc/network/interfaces:
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant.conf -B
Various fixes for Debian6-19-04-2012 image
- Enable SSH at boot if you need it (I do, very much):
sudo update-rc.d ssh defaultsor rename boot_enable_ssh.rc to boot.rc and reboot - this file is on FAT partition so you can do it even under Windows
- Broken /etc/apt/sources.list - apt-get complains about duplicate sources, easy to fix - debian sources should be in one line, not two:
deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free
- Disable services you possibly don't need (I know I don't) but come enabled by default:
sudo update-rc.d -f portmap remove
sudo update-rc.d -f nfs-common remove
sudo update-rc.d -f xinetd remove
- Fix NTP drift file location permissions - Raspberry Pi doesn't keep time (no battery) so it syncs with NTP after every boot:
sudo chown root:root /var/lib/ntp
Raspberry Pi boots up, brings up wireless interface and connects to the network. After firmware update I have not seen a single kernel panic or segfault yet, which is huge change to how my Pi behaved before. Basically it was dying on any operations that required some more wifi network use (wget was enough), more CPU and/or more RAM... and having 192MB of usable RAM (because we share RAM with GPU) made it really common situation.
Standard disclaimer - it works for me!