Make (Almost) Any Wifi Card Work with Ubuntu

(The following is an extract from my best-selling book Ubuntu Kung Fu, which contains over 300 tips, tricks, hints, and hacks for Ubuntu).

Ubuntu’s wifi support has gotten steadily better over the years, and with Ubuntu 8.04 (Hardy Heron) it’s safe to say that the majority of wifi devices will work fine. However, if you find that yours doesn’t (you’ll know because it will be like no wifi hardware is installed), help is at hand in the form of Ndiswrapper.

This lets you use Windows XP wifi drivers under Ubuntu. As you can imagine, it’s something of a hack and doesn’t always work, although in most cases the results are very good.

The following steps walk you through what’s needed to get XP wifi drivers working under Ubuntu. The guide is split into three sections: identifying your wifi card make and model, sourcing the Windows driver and extracting the driver file components, and finally installing the Windows XP driver files.

NOTE: If you’re using Ubuntu 8.10, first try installing the linux-backports-modules-intrepid package via Synaptic. 

Identifying the Wifi Card Hardware

To source the correct driver for your wifi hardware, it’s necessary to find out its make and model. However, you don’t need the make and model listed on the box or in the specification list. You must find out what company actually manufactured the hardware, which will probably be different from the company that sold it (particularly with more inexpensive hardware). You must also find out the PCI ID number, which is how operating systems like Ubuntu and Windows refer to the card on a technical level.

Open a terminal window, and type the following:

lspci -vv -nn|less -i

This will list the hardware on your system connected through the PCI bus (which is practically all of it). The command options specified cause lspci to return more information (-vv) and cause the vital PCI ID numbers to be returned too (-nn).

Hit the forward slash (/) to search, and type wireless. Then hit Enter. If you find no result, hit forward slash again, and search for wlan. If you still get no results, try searching for 802.11. These are the common terms used to describe wifi hardware. When you get a match, use the up/down cursor keys to scroll so you see the entire entry for that device (each entry is separated from the others in the list by a blank line). Make a note of the make and model name listed on the first line.

After this, look at the end of the same line for a pattern of numbers and letters that look like [168c:0013]—four digits, a colon, and then four more digits (the digits are hexadecimal, if knowing that helps you identify them). Write these down too. For an example taken from my test PC with the relevant parts of the entry in the listing highlighted, see the screenshot below. Be careful not to get the details mixed up with the Subsystem line.

Sourcing the Windows XP Driver

Finding the Windows XP driver isn’t too difficult. The easiest way of doing it is to head over the Ndiswrapper website and browse its database of cards, which links to the download sites of drivers known to work. Of course, you’ll need to do this using a computer that can get online (assuming your Ubuntu computer is currently unable to for lack of wifi drivers), and the easiest way of doing this is simply to boot into your Windows partition.

Once you’ve found the correct driver file, you must extract the components you need. The following instructions describe how all of this is done:

Use a web browser to head over to http://ndiswrapper.sourceforge.net. Once there, click the Documents/Wiki link on the left, and then click the link that reads List of cards known to work. On the following page, click the entry in the alphabetical list that refers to the first letter of the manufacturer details you discovered earlier.

In the listing page that appears, search using the PCI ID number you noted earlier. Note that you shouldn’t include the square brackets surrounding the numbers and letters. The details from my test PC were [168c:0013], so I searched for 168c:0013.

Note: At the present time (Nov 08), the Ndiswrapper site database is down. It’s not clear why this is, or when it will return to service. However, an Ubuntu community member maintains a copy of the database that can be found here.

It’s likely more than one entry in the list will match, so you should then check the details listed in the Card: and Chipset: components of the website listing against the manufacturer and model details you wrote down earlier. Try to get the best match possible. Some entries in the Ndiswrapper website list might even refer to the make and model of computer the wifi card is used in. Once you find a match, click the link provided to download the driver. Avoid any drivers marked as x86_64 in the list—these are designed to work on 64-bit versions of Linux (unless you have the 64-bit version of Ubuntu installed, of course, although this is unlikely unless you specifically opted to).

Once you have the driver file, you must extract the necessary driver components from it. To be frank, this is easier done using Windows rather than Ubuntu, so if you don’t already have Windows up and running, copy the driver installation file to your Windows desktop and then boot into Windows. Once Windows has started, download a program called Universal Extractor from http://legroom.net/software/uniextract. This is a clever open source program that’s able to extract files from just about any archive file, including Windows setup executable files (.exe). Once it’s downloaded and installed, right-click the Windows XP driver file, and select UniExtract to Subdir. This will create a new folder containing the individual driver files.

The files you want will probably be in a folder named WinXP, WindowsXP, or similar. If you’ve ever installed hardware drivers in Windows, this will sound familiar, although the folder might be called ndis5x or similar. In the folder, look for .inf files. If you’re in luck, there will be only one, and you can skip straight to the last step in this section. If there’s more than one, then you’ll need to search through each until you find the correct one.

Open the first .inf file in Windows Notepad by double-clicking it. Click Edit —> Find, and search for the first part of PCI ID you noted earlier. For example, the whole PCI ID number on my test PC was 168c:0013, so I searched for 168c. If you find no match, close the file, and move onto the next .inf file. If you do find a match, look further along that particular line, and look for the second part of the PCI ID. It will probably be next to the word DEV_. If you find a match, then congratulations! You’ve found the .inf file you need.

Copy the .inf file to a new folder, along with any .sys and .bin files you find in the driver folder (you may not find .bin files). Any other files can be ignored. You now have all you need to install the XP driver under Ubuntu, but don’t reboot just yet. First you’ll need to grab some package files from the Ubuntu repositories.

Installing the XP Driver Files

As mentioned, installing the XP drivers is easy, but first you’ll need to download and install the Ndiswrapper configuration software (the actual Ndiswrapper system software is already installed out of the box on Ubuntu). The following steps are all you need to do to install the driver:

Type the following addresses in the address bar of your browser. Each will cause a file to be downloaded:

http://us.archive.ubuntu.com/ubuntu/pool/main/n/ndiswrapper/ndiswrapper-utils-1.9_1.50-1ubuntu1_i386.deb

http://us.archive.ubuntu.com/ubuntu/pool/main/n/ndiswrapper/ndiswrapper-common_1.50-1ubuntu1_all.deb

http://us.archive.ubuntu.com/ubuntu/pool/main/n/ndisgtk/ndisgtk_0.8.3-1_i386.deb

Reboot into Ubuntu, and copy the XP driver files to the desktop, plus the three system software packages you downloaded. Open a terminal window, and type the following to install the software:

sudo dpkg -i ~/Desktop/ndis*.deb

Once installation has finished, click System —> Administration —> Wireless Network Drivers. Once the program window opens, click the Install New Driver button.

A dialog box will appear prompting for the location of the .inf file. Click the Location drop-down list to open a file-browsing window, and navigate to the .inf file. Then click the Install button.

In the Wireless Network Drivers program window, you will now see your wireless hardware listed on the left of the window. Beneath it should be listed the words Hardware present: yes, as shown in the screenshot above. If you see Hardware present: no, you have an incompatible driver. Select the hardware in the list, and click Remove Driver. Then repeat the previous steps to download an alternative driver.

After this, your wifi hardware will be immediately available for configuration using NetworkManager at the top right of the desktop. You can close the Wireless Network Drivers window and delete the driver and package files from the desktop.



__________

This tip is taken from Ubuntu Kung Fua recently published and best-selling book of over 300 excellent tips for Ubuntu. It’s available from all good bookstores although the PDF edition of the book is available for a recession-busting $22. The author, Keir Thomas, also wrote Beginning Ubuntu Linux, a “from zero to hero” guide to Ubuntu 8.04 and beyond, which has recently reached its third edition. Please take a moment to check out both of them, and also take a look at the rest of the site.

2 comments ↓

#1 Make (Almost) Any Wifi Card Work with Ubuntu — Ubuntu Kung Fu | How To Get WiFi on 11.13.08 at 6:33 pm

[...] Read the full post by unknown [...]

#2 Make (Almost) Any Wifi Card Work with Ubuntu | LTT: Linux Tips & Tricks on 01.03.09 at 3:41 pm

[...] the original post:  Make (Almost) Any Wifi Card Work with Ubuntu November 13th, 2008 in [...]

You must log in to post a comment.