LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By beginningubuntu at 2007-04-12 05:09
Here's a comprehensive and idiot-proof guide for utilizing NdisWrapper. It's extracted from Beginning Ubuntu Linux, Second Edition.



The guide is part of Chapter 8, which provides a full guide to hardware configuration under Ubuntu (including network devices, printers, scanners, 3D cards, and more).

In addition to detailing how to install/remove NdisWrapper drivers, this massive 3,500 word guide includes the vital steps of precisely matching the correct driver to the hardware, and then extracting the necessary files from Windows driver archive files. These steps are frequently overlooked by other guides and are a brick wall for many users.

The guide is aimed at Ubuntu Edgy Eft (6.10) users, although it should work on other versions of Ubuntu, including Feisty Fawn (7.04). In fact, with the application of some common sense, it should work on most other distros (a modified version of the guide is included in my other recent book, Beginning SUSE Linux, Second Edition).

Without further ado, let's get on with it.

Using NdisWrapper
NdisWrapper is effectively an open-source driver (technically described as a kernel module) that allows Linux to use standard Windows XP drivers for wireless network devices. You might describe NdisWrapper as being a translation layer between the Linux kernel and the Windows drivers, which can be installed using NdisWrapper’s configuration tools.

You should only use NdisWrapper in one of two situations:
  1. Your wireless network hardware simply isn’t recognized by Ubuntu, which is to say, no entry for the wireless hardware appears in the list of network devices in the Network Settings configuration dialog.

  2. Your network hardware is recognized by Ubuntu but fails to work correctly when you configure it. Perhaps it is unable to associate with wireless base stations, for example. If this is the case, in addition to installing NdisWrapper, you’ll have to undertake an additional step in order to blacklist the existing Ubuntu driver. This is explained later.
Using NdisWrapper is relatively simple and just a handful of commands are required. However, getting hold of the necessary Windows driver files is harder work because, unfortunately, NdisWrapper isn’t designed to work with the usual method of driver distribution: .exe files. Instead, NdisWrapper needs the specific .inf and .sys files that constitute the driver—effectively, the Windows system files. In many cases, these are contained within the .exe file and must be manually extracted.

Note Of course, sometimes drivers are distributed as .zip files, in which case the relevant files are easy to get at. Keep your fingers crossed that this will be the case for your particular hardware!

NdisWrapper is far from perfect. Not all wireless devices have been proven to work with it, and it’s not necessarily the case that a driver available for Windows will work under Linux. Sometimes trial and error is required. Annoyingly, Windows drivers sometimes appear to work but then prove unreliable. Some might stop working. Some might even crash your system. The best plan is simply to give it a try.

Tip NdisWrapper gets better and better with every new release. This is why it’s a good idea to update your system on a regular basis. I give full details of how this can be done in Chapter 9 of Beginning Ubuntu Linux, Second Edition.

I'm going to explain how to make an Asus 802.11g wireless network device that’s built into an Asus A6R notebook work under Ubuntu using NdisWrapper. The instructions remain essentially the same for all types of wireless network hardware. However, some specific details, such as download addresses, will obviously differ.

First, I explain how to install the NdisWrapper software. Next, I explain how to discover what Windows drivers you need. Following this, I explain how to extract the necessary files from the driver archive, and finally, how to actually install the Windows drivers under Ubuntu. You might also need to blacklist the existing Linux driver, which I also cover.

These steps merely make your wireless network device available under Ubuntu. Once completed, you should use the standard network configuration utilities to associate with your router or base station. This is covered in detail in Chapter 8 of Beginning Ubuntu Linux, Second Edition.

Installing the NdisWrapper Configuration Tools
NdisWrapper consists of two components: a kernel module and configuration tools. The kernel module comes as part of the default kernel package, so is installed by default. Therefore, all you have to do is install the configuration tools. Start Synaptic Package Manager, and search for and install ndiswrapper-utils-1.8. You’ll be told that ndiswrapper-common also needs to be installed. This is fine.

Note Ensure that you select ndiswrapper-utils-1.8 if you're using Edgy Eft (6.10), and not any other version of NdisWrapper! A packaging bug means that other versions won't work correctly.

Installing the Windows XP Drivers
Once the NdisWrapper configuration software is installed, you can install the Windows XP wireless network device drivers. There are three parts to the procedure:
  1. Identify the wireless network hardware in your computer and then source the appropriate Windows driver.

  2. Extract the necessary .sys and .inf files from the driver archive (and possibly .bin files, although this is rare).

  3. Use the NdisWrapper configuration tools to install the Windows driver, and tweak a configuration file so that the NdisWrapper kernel module loads each time you boot.
All three steps are dealt with separately in the following sections. In later stages, you will need another computer that’s already online to download some files and check the NdisWrapper web site for information. If your computer dual-boots, you can use your Windows setup to do this.

Identifying Your Wireless Network Hardware and Sourcing Drivers
To identify the wireless network hardware for use with NdisWrapper, it’s necessary to discover two pieces of information: the make and model of the hardware, and the PCI ID number.

The former is the make and model of the hardware, as identified by Ubuntu as a result of system probing, rather than what’s quoted on the packaging for the wireless network device or in its documentation. These details discovered by Ubuntu will usually relate to the manufacturer of the underlying components, rather than the company that manufactured the hardware.

The PCI ID is two four-digit hexadecimal numbers used by your computer to identify the device internally. The same PCI ID numbering system is used by both Windows and Ubuntu, which is why it’s so useful in this instance.

Follow these instructions to discover the information you need:
  1. You can find both the PCI ID and the make/model information using the Device Manager tool. Start System -> Administration -> Device Manager.

  2. What you do now depends on whether your wireless hardware is recognized by Ubuntu (which is to say, it appears in Network Settings but doesn’t work properly). If the device isn’t recognized, skip to the next step. If it is recognized, look in the list of hardware that appears, and find the entry that reads WLAN Interface. Then look at the entry immediately above this in the list, where you’ll find listed the make and model of the hardware. Write this down. On my test notebook, containing an ASUS wireless network device, this read BCM4318 [AirForce One 54g] 802.11g Wireless Lan Controller. As anticipated, these details don’t relate to those listed in the wireless network device’s documentation (the notebook’s manual lists the hardware simply as an ASUS 802.11g device). This is because Ubuntu is identifying the hardware generically, reading information from its component hardware. Select the WLAN Interface entry, and click the Advanced tab on the right side of the program window. Then look through the information there for the line that begins net.physical_device. Look at the end of the line, and make a note of the two sets of letters and numbers that are separated by underscore characters and are preceded by pci_. On my test notebook, these were 14e4 and 4318, as shown in the screenshot below, in which the relevant areas are highlighted.

  3. If the wireless hardware isn’t recognized by Ubuntu (which is to say, it doesn’t appear in the Network Settings dialog box), look in the Device Manager list of hardware for an entry mentioning 802.11, WLAN, or possibly simply "wireless". This entry in the list will be the make and model details you need, so write them down. Next, select the wireless device’s entry in the list, and click the Advanced tab on the right side of the window. Look through the information there for a line that reads info.udi. Look at the end of the line, and make a note of the two sets of letters and numbers that are separated by underscore characters and are preceded by pci_. Look at the screenshot below for guidance.

    Note These two clusters of letters and numbers are actually hexadecimal digits. For more details on hexadecimal, see http://en.wikipedia.org/wiki/Hexadecimal.



  4. When written alongside each other, the two sets of digits you noted in step 2 or 3 become the PCI ID number. In written form, they’re usually separated by a colon, so in my case, the PCI ID of the wireless network device is 14e4:4318. If either of the sets of letters or numbers is less than four characters long, simply add zeros before them in order to make four characters. For example, on my desktop PC, the end of the net.physical_device line read 1814_201. I added a zero before 201, making the complete PCI ID of 1814:0201. On another of my test PCs, the end of the line read 168c_13. I, therefore, added two zeros before the 13 to make a PCI ID of 168c:0013.

  5. Using another computer that’s able to go online, visit http://ndiswrapper.sourceforge.net/mediawiki/index.php/List. This is a community-generated listing of the wireless network devices that have been proven to work with NdisWrapper.

  6. Using the search function of your browser (Ctrl+F within Firefox), look for the PCI ID number you noted earlier, in the format described in step 4. For example, with the PCI ID I discovered on my test notebook, I searched for 14e4:4318. In the list, look to match the following things, presented in order of importance:

    - The PCI ID.

    - The manufacturer and model name of the wireless hardware, as reported by Device Manager; this will be listed in the Card: part of the entry in the list and/or within the Chipset: section too.

    - The manufacturer and model of the notebook, as mentioned on its case or within its documentation. This will be mentioned in the Card: or Chipset: sections or possibly within the Other: section.

    It’s likely many entries in the list may match your PCI ID, so search until you find the one that best matches the manufacturer and model of the hardware. If there are still many matches, search until you find an entry that matches the manufacturer and model of the notebook. You might not be lucky enough to find an exact match for the notebook manufacturer and model, however, and you might have to select the most likely choice. Use your common sense and judgment. If your notebook is manufactured by Asus, for example, but you can’t find the drivers for the exact model, then choose drivers for another Asus model.

    Caution Unless you're using a 64-bit version of Ubuntu, watch out for any mention of x86_64 in the description of the driver file. If you haven't specifically chosen to use 64-bit Linux, you'll probably be using 32-bit. If you encounter an entry relating to x86_64, keep searching.

  7. Look within the entry in the list for a direct link to the driver file. Sometimes this isn’t given, and a manufacturer web site address will be mentioned, which you can visit and navigate through to the driver download section (usually under the Support section within the web site). Download the Windows XP driver release.

Extracting the Driver Components
Once the drivers are downloaded, you’ll have to extract the .sys and .inf file relevant to your wireless network hardware. These are all that NdisWrapper needs, and the rest of the driver files can be discarded. However, extracting the files can be hard to do, because often they’re contained within an .exe file.

Note Most driver .exe files are actually self-extracting archive files.

Additionally, the driver file might contain drivers for several different models of hardware, and it’s necessary to identify the particular driver .inf file relevant to your wireless network device:
  1. If the driver you’ve downloaded is a .zip file, then your task will probably be much easier. Simply double-click the downloaded .zip file to look within it for the directory containing the actual driver files. Often this directory is called "driver", or sometimes it’s named after the OS for which it contains files, such as Win_XP. If you’ve ever installed Windows drivers then this will sound familiar. Once you’ve found the relevant directory, click and drag the .inf, .sys, and .bin files to a separate folder (there probably won’t be any .bin files, however). You can ignore any other files, such as .cab and .cat files. Then go to step 4.

  2. If the driver is an .exe file, it’s necessary to extract the files within it. With any luck you might be able to do this using an archive tool like WinZip (www.winzip.com), assuming that you’ve downloaded the file using Windows. Simply open the archive using the File -> Open menu option within WinZip. You may have to select All Files from the File Type drop-down list in order for the .exe file to show up in the file list. However, if you’re using Windows, I recommend an open-source and free of charge program called Universal Extractor, which can be downloaded from http://www.legroom.net/software/uniextract. This program can extract files from virtually every kind of archive, including most driver installation files. Once it is installed, simply right-click the installation .exe file, and select UniExtract to Subdir. This will then create a new folder in the same directory as the downloaded file, containing the contents of the installer file.

  3. As mentioned in step 1, it’s likely the driver files you need will be contained in a folder called something like Driver or Win_XP. Once you’ve found the relevant directory, look for .inf, .sys, and .bin files (although you may not find any .bin files; they’re only used in a handful of drivers). Click and drag the files to a separate folder. You can ignore any other files, such as .cab and .cat files.

  4. The task now is to find the .inf file for your hardware. If there’s only one .inf file, then you can move to the next step. If there’s more than one, you’ll need to search each until you find the one you need. You need to look for text that corresponds to the PCI ID you noted earlier. Open the first .inf file in a text editor (double-clicking will do this in Windows), and using the search tool, search for the first part of the PCI ID, as discovered earlier. For example, I searched for 14e4. If this isn’t found within the file, move on to the next .inf file, and search again. When you get a search match, it will probably be in a long line of text and to the right of the text VEN_. Then, look further along that line to see if the second part of the PCI ID is mentioned, probably to the right of text that reads DEV_. In the case of the driver file I downloaded, the entire line within the .inf file read as follows (I’ve highlighted the two component PCI ID parts in bold):

    Code:
    %BCM430B_DeviceDesc% = BCM43XX, PCI\VEN_14E4&DEV_4318&SUBSYS_12F3103C
    If you find both component parts of the PCI ID in the line, as in my example, then you’ve found the .inf file you need. (In actual fact, you’ll probably find many lines matching what you need; this is no issue.)

  5. You must now transfer the .inf file, along with the .sys and .bin files (if any .bin files were included with the driver) to the computer on which you want to install the drivers. This can be done by putting them onto a floppy disk, by burning them onto CD, or using a USB memory stick.

Blacklisting Existing Drivers
Your progress from this point onward depends on if Ubuntu recognized your wireless networking device when you first booted but was unable to make it work correctly. If it did then you will have to blacklist the built-in driver, so that NdisWrapper can associate with the hardware. If the device wasn’t recognized, you can skip straight to the “Using NdisWrapper to Install the Drivers” heading.

To blacklist the existing driver, you need to find out the name of the kernel module and then add it to the /etc/modprobe.d/blacklist file. Here are the steps:
  1. Open Device Manager (System -> Administration -> Device Manager), and select the entry in the list for your wireless network device. Click the entry mentioning the make and model of your network hardware.

  2. Click the Advanced tab on the right-hand side of the window, and look for the line that begins info.linux.driver. Then look in the value column, and make a note of what’s there. For example, on my test notebook, the value column read bcm43xx.

  3. Close Device Manager, and open a terminal window (Applications -> Accessories -> Terminal). Type the following to open the blacklist configuration file in the Gedit text editor:

    Code:
    gksu gedit /etc/modprobe.d/blacklist
  4. At the bottom of the file, type the following on a new line:

    Code:
    blacklist <modulename>
    Replace <modulename> with the name of the module you discovered earlier. For example, on my test system, I typed the following (as shown in the screenshot below):

    Code:
    blacklist bcm43xx
    Save the file, and reboot your computer. You should now find that the wireless network device is no longer visible in the Network Settings program window. This is good, because it means the hardware no longer has a driver attached, and we can now tell NdisWrapper to make use of the hardware.




Using NdisWrapper to Install the Drivers
On the Ubuntu computer on which you wish to install the drivers, you should now have the .inf file from the previous steps, plus the .sys and possibly .bin files that constitute the driver. Copy the files from the removable storage device into an empty folder on the desktop. Name the new folder "driver".

Note If you’ve used a USB memory stick to transfer the files, it should appear automatically on the desktop as soon as it’s inserted. When you’ve finished with it, right-click the desktop icon, and select Eject. You must do this before physically removing any kind of USB memory device. I describe how to handle removable storage devices in Chapter 8 of Beginning Ubuntu Linux, Second Edition.

To install the driver using NdisWrapper, follow these instructions:
  1. Open a terminal window (Applications -> Accessories -> Terminal). In the window, type the following to switch to the directory containing the driver files:

    Code:
    cd /home/<username>/Desktop/driver
    Replace <username> with your own username.

  2. To install the driver, type the following:

    Code:
    sudo ndiswrapper –i filename.inf
    Replace filename.inf with the name of the .inf file you discovered in the previous steps.

  3. Next, type the following:

    Code:
    sudo ndiswrapper –m 
    gksu gedit /etc/modules
    This will open the modules configuration file for editing. On a new line at the bottom, add the following:

    Code:
    ndiswrapper
    Ensure you press Enter after adding the line.

  4. Save the file, close Gedit, and reboot your computer.
Following this, you should find the network device is available for configuration, such as associating with a wireless base station and configuring WEP/WPA. I explain how to configure both WEP and the newer WPA in Chapter 8 of Beginning Ubuntu Linux, Second Edition.

Removing NdisWrapper Drivers
As mentioned earlier, although NdisWrapper can solve a lot of headaches with nonworking wireless hardware, it isn’t perfect. You might find that the Windows driver you install simply doesn’t work. In such a case, you can download a different version of the driver and try again. But first you’ll need to uninstall the existing driver.

Open a terminal window, and type the following, which will cause NdisWrapper to list currently installed Windows drivers:

Code:
sudo ndiswrapper –l
Look for the first component of the line that’s returned. On my test notebook, the line read:

Code:
bcmwl5   driver installer, hardware present
The first component of the line will be the name of the driver that you need to remove. To remove it, type the following line:

Code:
sudo ndiswrapper –e <drivername>
Replace <drivername> with the name of the driver. For example, I typed the following:

Code:
sudo ndiswrapper –e bcmwl5
Now, you can repeat the preceding step discussing sourcing the Windows driver. Note that there’s no need to repeat all of the steps under the “Using NdisWrapper to Install Drivers” heading discussing installing the NdisWrapper modules. All that’s necessary once you grab the new driver file is to issue the "sudo ndiswrapper –i" command, specifying the new driver .inf file.

Note The Broadcom BCM4318 wireless device, used as an example here, is extremely common in modern notebooks. Although work is being undertaken to make it work under Ubuntu, at the time of this writing, support is patchy. Therefore, a lot of Ubuntu users with notebooks containing this hardware utilize NdisWrapper to make it work. In fact, a handful of community members got together and created an installation script to make the process a lot easier. The script will automatically blacklist the existing driver and install a new one. You can find more information at the Ubuntu Forums: http://ubuntuforums.org/showthread.php?t=197102.

by sridhar11 on Thu, 2007-04-12 11:33
If you want to enable WPA Wireless access point try this guide this really works

by orbin on Wed, 2007-04-25 06:57
Quote:
Originally Posted by beginningubuntu
A new la entry has been added:

NdisWrapper: The Ultimate Guide
Hi,

Noticed that for the some of the commands in the code boxes, you have used a character other than minus in the options, which causes the usage information to be displayed instead of the command being parsed:

Code:
jb@koji:~$ sudo ndiswrapper –l
install/manage Windows drivers for ndiswrapper

usage: ndiswrapper OPTION
-i inffile       install driver described by 'inffile'
-a devid driver  use installed 'driver' for 'devid'
-r driver        remove 'driver'
-l               list installed drivers
-m               write configuration for modprobe
-ma              write module alias configuration for all devices
-mi              write module install configuration for all devices
-v               report version information

where 'devid' is either PCIID or USBID of the form XXXX:XXXX,
as reported by 'lspci -n' or 'lsusb' for the card


  



All times are GMT -5. The time now is 09:03 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration