I spent the last week and a half trying to set up a PCI WiFi for whitey's Linux box. I'm going to use a lot of technical terms in hopes that Google will pick up this page and provide some help to others. So here's how to set up the WiFi card under Linux.

Ok, two weeks ago we got a D-Link DWL-G520 (many people refer to it as the DWL-520 however). There are aparently several revisions of this card, some use the Prism2 driver, some use the Atheros driver, and others (the DWL-G520+) uses the ACX100 driver.

This one in particular however, uses the Atheros driver. Just to remove all confusion, if you have this card installed when you run 'lspci' you'll see an Atheros 5212 listed. The 5210 is 802.11a, the 5211 is 802.11b and the 5211 is 802.11g. There are several sites out there that try to list cards and match them up with drivers and one of them even lists the FCC ID. The FCC ID that I've seen for the DWL-520 series cards starts with OJC. This DWL-520 card's FCC ID starts with KA2. If the FCC ID on your card is different then you might not want to follow these instructions.

On to the drivers. We tried several that didn't work. The prism54 drivers that were very highly recomended seem to be for a different DWL-520 and they wouldn't even load. Next we tried the linux-wlan-ng drivers with the prism2_pci, which seemed to work but when I tried to init the driver I got "wlanctl-ng: no such device".

After several hours of searching mike and I eventually decided to give the madwifi project a try. This eventually worked. So, here's what you need to set it up.

First thing is the kernel sources or have the build headers that were used to build your kernel (if you have a binary kernel). I suggest building your own. If you don't build it yourself you may have trouble compiling the drivers. In this case, don't ask me because I'm a little fuzzy on telling kernel modules "here's the kernel headers but not the sources, please don't hurt me".

You'll also need the Wireless Tools for Linux. If you're using Debian like we are you can just apt-get install wireless-tools and sing a song while Apt does all the legwork for you.

Now you're ready to build the driver. Follow the instructions on the madwifi cvs page, except where it says modulename type madwifi instead (this part confused me for a while because they don't make it obvious). At this point cd to the madwifi directory and type make then as root run make install. After it's compiled and installed run modprobe ath_pci ath_hal wlan.

Whew, almost there.

At this point, unless you've had a major error in compiling code your card is active and working. Run iwconfig ath0 essid "foo" where "foo" is the SSID if your hotspot (you did configure this on your hotspot, right?). If you "forgot" what your hotspot's SSID is you can run ifconfig ath0 up then iwlist ath0 scan to get a list of available hotspots. After setting your SSID run dhclient ath0 and open Firefox. Have a lot of fun!

Now, this is all fine and good until you reboot. Add ath_pci, ath_hal and wlan to the end of /etc/modules each on their own separate line. You'll need to figure out how your distro handles bringing up network interfaces. If you're using Debian add the following lines to /etc/network/interfaces

auto ath0
iface ath0 inet dhcp
pre-up iwconfig ath0 essid "foo"

Again, remember to replace "foo" with your real SSID. If all is well things will work after reboots.

Now, have fun. One more thing…if you found this page and it was helpful to you in setting up your DWL-520 PCI card please post a comment below (this is not a requirement however).

The content on this site is normally licensed under a non-commercial creative-commons licence. However, this article is under the MIT License.

Copyright (c) 2004 Brian "Bahamat" Bennett

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.