Tags: programming | raspberry pi
← 'grasping the Pi, part 2: an SD card full of aweso...
'grasping the Pi, part 4: traceberry Pi' →
Linux is very famous for having problems with certain hardware, including NVIDIA Hybrid SLI (and its successor, the infamous NVIDIA Optimus) -enabled GPUs and various wireless chips. The situation has been improving recently -- there are a lot of open- and closed-source wireless drivers available (that still require some weird actions, like downloading things from a computer that doesn't have the Internet connection to make the Internet connection work), but for some chips the situation is still bleak.
I had a D-Link DWL-G132 USB wireless dongle lying around. Plugging it into the Pi and doing lsusb revealed this:
Bus 001 Device 004: ID 2001:3a03 D-Link Corp. DWL-G132 (no firmware) [Atheros AR5523]
Bad news: there is no firmware for the wireless dongle. Good news: we found the name of the chip that it uses, i.e. Atheros AR5523. I first decided to acquire the firmware, since it seemed like the actual driver was already in the system.
A Google search revealed that there existed a driver called ar5523 (surprise!) and it apparently hadn't made it yet into the kernel. I downloaded the firmware from its page, copied it into my
/usr/lib/firmware and restarted the Pi. Nothing.
I tried using ndiswrapper, which is essentially a way to adapt the Windows driver to work on Linux, but a comment here stated that ndiswrapper only worked on the x86 architecture.
I then resorted to compiling the driver myself using the instructions here (I had some experience with kernel modules -- I use the xps_nv module that disables the discrete video card on my Studio XPS so that it doesn't draw power). However, simply following the instructions didn't work -- the kernel headers were missing. Or that's what the build system thought. Since a recent update, the
/lib folder in Arch Linux got deprecated and was supposed to be symlinked to
/usr/lib (or that's just the way Debian stores the kernel header files). I edited the Makefile again, pointing it to the actual headers and tried to compile the module again. Nope.
I then found some patches in the folder with the source code and applied them. Nothing. I also investigated this and this blog posts where the writer had exactly the same problem and applied the patches that he had there. The compilation errors remained. However, the definition of some functions in the kernel had changed, according to a comment in that post linking to here) and the author didn't replace all occurrences of the functions in the source. Doing that did the trick and I ended up with a .ko file -- the kernel module.
The complete patchfile is available on the Pastebin.
I then copied the .ko file into
/usr/lib/modules/(my kernel version)/kernel and did
sudo depmod -a
sudo modprobe ar5523
ifconfig -a then showed that a mysterious wlan0 interface appeared on the system. Doing
sudo ifconfig wlan0 up then made the light on the dongle flash. Hooray!
Well, not really. Searching for networks (
iwlist wlan0 scan) didn't show anything useful. My next quest apparently had to be postponed.