Ndiswrapper

From openSUSE

(Redirected from Ndiswrapper howto)
Wireless Navigation
WiFi HOWTO | Wireless cards quality | Connecting to a wireless network | Ndiswrapper


Contents

Introduction


Driver support for Atheros-based wireless cards has been removed in version 10.1 due to licensing issues [1] [2]. There are two possible work-arounds available:

  1. madwifi - an open-source Linux kernel device driver for Wireless LAN chipsets from Atheros
  2. ndiswrapper - an implementation of the win32 API used in conjunction with the original Windows drivers

Either method may work, and it is recommended that you try madwifi first (if you have a Atheros-based card). If you can't get madwifi to work then ndiswrapper will most likely do the job, although you may experience some minor issues (more info needed here). This article will describe the process of getting your wireless card to work with both of the above methods.

Ndiswrapper


Ndiswrapper uses the Windows *.inf driver files that came with your hardware to operate your wireless card on Linux.

Some vendors do not release specifications of the hardware or provide a Linux driver for their wireless network cards. The Ndiswrapper project implements Windows kernel API and NDIS (Network Driver Interface Specification) API within the Linux kernel. A Windows driver for wireless network card is then linked to this implementation so that the driver runs natively, as though it is in Windows, without binary emulation.

Where to get Ndiswrapper


Ndiswrapper is included with your SUSE installation CD's. Use the software management utility in YaST and make sure the following packages are installed:

  • ndiswrapper
  • ndiswrapper-kmp-[default|smp|xen]
  • wireless-tools

Choose the proper kernel module package (kmp) for your architecture. Most people will just need to use "ndiswrapper-kmp-default".

driver:wireless Repository

OpenSUSE 10.3 users could found the latest ndiswrapper on driver:wireless Repository.

If you use Updates repository you must use http://download.opensuse.org/repositories/driver:/wireless/openSUSE_10.3_update

If you do not use Updates repository (check your kernel with uname -r you should receive 2.6.22.5-31-*) please use http://download.opensuse.org/repositories/driver:/wireless/openSUSE_10.3

Source code

You can also get the latest versions directly from the ndiswrapper site.

Package installation

Be sure that your card is not supported by any other packages. The package wlan-kmp-default (or wlan-kmp-bigsmp or ... -- depends on your kernel) contains some wireless drivers. You're lucky, and don't have to use the ndiswrapper then.

Open YaST and install the software packages ndiswrapper and ndiswrapper-kmp-something (something depends on your kernel, usually: ndiswrapper-kmp-default) via: Software → Software Management

Hint: You might want to install package wireless-tools additionally, as you might need them if the card is running. :)

Hint: You can type the following command to figure out which type of kernel it is as well as the version:

# uname -r

Obtaining the Windows Driver


Note: You may be able to determine which driver you need by looking for your specific hardware in the ndiswrapper compatiblity list

Note: If you are running a 64-bit Linux kernel, you MUST find the 64-bit Windows driver (which is somewhat harder to find than the 32-bit Windows driver)! So, if you can't find the 64-bit Windows driver, you'd need to install the 32-bit version of openSUSE instead, if you plan to use ndiswrapper!

From Your Windows Partition

If you have a dual-boot machine and you have your card properly working in Windows, AND if your Linux is the 32-bit edition (since most Windows are 32-bit!) then one way to get your driver is to get it from the Windows partition itself. [In other words, you CANNOT use a 32-bit Windows driver on 64-bit Linux!]

Under Windows, go to the Device Manager and find your wireless card under "Network adapters". Right-click on this and go to Properties->Driver->'Driver Details...'. Here you should find the path to a *.sys file, usually located in your C:\windows\system32\drivers\ directory.

Now you will use the Windows "Search" functionality to find the corresponding *.inf file, which is nothing more than a simple text file (try opening one!) with a list of all the required driver's files. So a sample search query in Windows would be:

Windows Search Query
All of part of the file name:*.inf
A word or phrase in the file:<the *.sys path found above>
Look in:Local Hard Drives (C:)

This search may take a while! When you've found it, look inside the *.inf file with a text editor and see if you need to find any more files. If you're lucky, everything should be in a single directory (for example C:\Program Files\Atheros\Drivers\). Copy all these files to a single location (e.g. in /home/myuser sub-tree) or to an external USB drive which is accessible to your Linux system.

From the Driver Installation Software

There are several places where you can try to find your drivers, listed here in order of preference:

  • the installation CD that came with your hardware
  • your PC or card manufacturer's support web site
  • by searching for your *.sys file with Google

If you're lucky, you will find the proper *.inf and associated files very easily. Sometimes, you will need to uncompress a *.cab file which contains your drivers. Tip: you can browse cab files with websites such as driveragent.com. You can try unpacking these *.cab files with any of the following:

Again, once you find all your files, copy them to a single location which is accessible to your Linux partition.

Dealing with Multiple *.inf Files

If there's two or more .inf files don't panic, each one is for a different version of windows. My driver's disc has two:

bcmwl5a.inf
and
bcmwl5.inf

The first is for win98 the second is for Win2K, Me, and XP. In my case, the win 98 driver works and the xp didn't.

Installing Your Drivers


Open up a console window and execute su command (if you don't know what that is, the su command means "switch user" which can be the super user -- root---. It will ask you the root password).

Now type:

ndiswrapper -i /path/to/drivers/bcmwl5a.inf

Be sure to include the path to your .inf file.

You might refer directly to any windows owned folder. If the way to this folder (the pathname) contains white spaces, e.g. "Program Files", it is recommended first to move with cd to the folder containing the required xxx.inf file:

cd '/windows/where the inf file is'
ndiswrapper -i this_and_that.inf   

If all goes well, type:

ndiswrapper -l

If you installed a valid/compatible Windows-driver, ndiswrapper will display something like this:

<driver-name> : driver installed
device (xxxx:xxxx) present (alternate driver: <native-driver-name>)

Where <driver-name> shows the name of the windows driver installed with ndiswrapper and <native-driver-name> is the name of the Linux native driver being overridden. [Note: This native driver may need to be 'blacklist'ed if it is installed and is being detected, as indicated in the logfile: '/var/log/messages'. Blacklisting prevents the native driver from trying to operate the hardware, since we want ndiswrapper's driver to operate it. To blacklist a native driver, add a line to the file '/etc/modprobe.d/blacklist' that reads: 'blacklist <native-driver>' (without the single-quotes, where <native-driver> is the actual name of the driver to be blacklisted).]

If ndiswrapper says "invalid driver" then you need to uninstall that driver and try a different one.

To uninstall a driver, you need to type:

ndiswrapper -r <then the name of the driver to uninstall>

An additional check can be to look at

/etc/ndiswrapper 

if a directory named as the installed driver is there available.

USB WLAN Stick

Comment from martin Falinski (27.06.06)

If you have a USB WLAN Stick it could be an advantage. Tell the ndiswrapper the VendorID and the ProductID with the -d option. Look for the id's in Yasts Hardwareinformation category USB. This are two four-characters/digits numbers like 168c and 0013.

To link the USBID to the driver you have to type:

ndiswrapper -d xxxx:xxxx <then the name of the driver>

have a look with the command:

dmesg

for successfully loading/connecting the driver. If not back to Step Two!

If it works you can write the alias for the ndiswrapper in the modules.conf with

ndiswrapper -m

Then see if ndiswrapper will be loaded with the command

modprobe ndiswrapper

after that you can configure it with Yast

        • comment end from martin Falinski (27.06.06)

Ndiswrapper Initialization


Type

modprobe ndiswrapper

After modprobe has run, if you've configured your card in YaST, then you can run

 rcnetwork restart 

that is the same as (just lesser typing)

/etc/init.d/network restart
to restart your network manager and the card should activate correctly.

Network configuration

Having a driver, doesn't mean, that your card is running. :) You need additionally to configure the network things for your card.

There are many possible configurations possible. I'm explaining only a typical example: DHCP, and managed via (KDE) network-manager.

  • Start YaST's network configuration:   Network Devices → Network Card
  • Choose: "User controlled with Network Manager" and then "Next"
  • Choose: "Add" button in lower half
  • Choose:
    • Device Type: "Wireless"
    • Configuration Name: "0" (or whatever :))
    • Hardware Configuration Name: "static-0"
    • Module Name: "ndiswrapper"
    • Options: "" (keep empty)
    • Do not select "PCMCIA" nor "USB"
    • ... and finally "Next"
  • On next screen select DHCP in "Hostname and Name Server" and in "Advanced → DHCP Options", then click "Next"
  • In "Wireless Network Card Configuration"-window choose (= keep the defaults):
    • Operation Mode: "Managed"
    • Network Name (ESSID): "" (keep empty)
    • Authentication Mode: "Open"
    • Input Type: "Passphrase"
    • Encryption Key: "" (keep empty)
    • .. . and finally "Next"
  • the kwallet manager might open -- give him your password and ignore this opening (it doesn't do anything)
  • ignore the warning that "Encryption is doing on own risk"
  • back in "Netwark Card Configuration Overview" choose "Next"

Your card is configured.

You might now open the Network Manager in your taskbar (kicker) and select one of the found networks. Disable your wire connection (if connected), and access the internet.

If your SSID (wireless network name) is not broadcasted, you can select an own, specific one in the Network Manager.


Finished. :)

Potential Conflicts & Issues



Compiling from Source with 1.46 and Above

Ndiswrapper 1.46 and above require a 2.6.17 or higher kernel in order to compile properly. Only OpenSUSE version 10.2 and newer ship with 2.6.17+ kernels; users of previous SUSE versions will need to either upgrade their kernel or use a version equal to or older than 1.45. Naturally, users who opt for the precompiled ndiswrapper-kmp-<flavor> packages that ship with the CDs/DVDs can ignore this issue.

Conflicts With NetworkManager

Anybody else have issues here?

I have found, in openSUSE 10.2, that only ifup works when configuring the wireless connection (IP address, encyption, authenication, etc) via YaST.

I'm using a broadcom wireless device built into a laptop. It uses the bcwl5a.inf drivers.

Loading Ndiswrapper at Boot

One method that can work is to edit your network script in /etc/init.d/network.

Add in a line that says modprobe ndiswrapper before it gets to the actual networking script so that ndiswrapper is loaded prior to the script running.

Note, this should not be required if you configure your wireless interface with YaST and enter 'ndiswrapper' in the 'module name' field. This should load the ndiswrapper kernel module at boot.

Loading Ndiswrapper at Boot (opensuse 10.3)

In some cases (USB wlan?) configuring the wireless interface with YaST, does not load the ndiswrapper module automatically in opensuse 10.3. To get you wlan card to work at boot time, you have to edit your network script in /etc/init.d/network (as described above).

Another method is to edit the config file /etc/sysconfig/kernel, by adding ndiswrapper into MODULES_LOADED_ON_BOOT section (e.g.: MODULES_LOADED_ON_BOOT="ndiswrapper").

Problems with Suspend to Disk/RAM

More to come...

Configuring your card in YaST


After installing ndiswrapper, open the Yast Control Center (yast2) and go to the Network Devices tab on the left side. Then click on the Network Card icon. This will bring up the Network Setup Method wizard. Accept the "User Controlled with NetworkManager" default and click Next.

In the Network Card Configuration Overview, click on "Add".

In the Manual Network Card Configuration, select "wireless" from the dropdown menu, leave everything else default and type in ndiswrapper in the module name box. Click on "Next".

On the Network Address Setup, goto the general tab, and set the Firewall to "External Zone". This may need some experimentation. Set Device Activation to Boot time (or Hot Plug). Click on "Next".

On the next screen configure the settings for your network. I've found it's best to leave the ESSID and encryption key fields empty and to let KDEWallet configure this, otherwise there may be conflicts. Most of the time, your Operating Mode will be set to "Managed". Again, you may need to experiment a bit.

In this context, I would like to share my experience of making the Broadcom Dell 1390 mini-pci wireless card work in a Comapq Presario V6000 laptop after I had installed OpenSuSE 10.2 (64 bit) in a dual boot configuration with Windows Vista Home (32 bit). Hopefully, this will save you some time and a lot of frustration, if you are on a similar track.

The laptop was connecting fine to the internet under Windows Vista through a Linksys wireless router with WPA-PSK security and it was set not to broadcast the network's ESSID. My objective was to achieve the same functionality under OpenSuSE 10.2. The first problem was to get the wirelss card recognized. I had to use ndiswrapper with bcmwl5.inf and bcmwl564.sys (available as the self-extracting R151517.EXE file from the Dell download centre) driver files for that. No other method worked. Then I tried to configured the card using YaST as described above. Although the blue light was now on, and the card could detect other visible secure networks when I used ' iwlist wlan0 scan ' it did not see my network (this was understandable as the ESSID was not broadcast). I could neither configure the security settings using YaST. The iwconfig command always reported the default settings only. It was such a frustration! Then I used the KDE KNetworkManager utility and the problem was solved. I could configure the wireless card for my secure network and connect to the internet - it was a doodle. The only thing is that you need to fire up knetworkmanager every time you boot up, so need to put it in your shell's profile file.

Connection problems

Once you have ndiswrapper working you will see that the LED for the wireless card lights up with network start i.e. at boot or in response to the command issued as root:

$ rcnetwork restart 


You will be able to see the available networks via the KDE network manager or by issuing the command issued as root:

$sudo iwlist wlan0 scan

So you find your preferred network and attempt to connect. However, there are few pitfalls to avoid...

The release notes for openSUSE 11.1 state that there is no out of the box support for channels 12-14 inclusive. By default, the WLAN channels 12, 13, and 14 are disabled because it is not allowed to use these channels everywhere. If you want to use them in your region, see http://en.opensuse.org/Tracking_down_wireless_problems for more information.

So make sure your router isn't using these channels unless you have manually enabled them as described in the URL above.

I have also found problems with channels 1,2 and 3 on my Netgear DG834PN and with a Thompson Speedtouch from BeThere. I found that connection was near impossible with WPA-PSK enabled and really unreliable without encryption. The signal kept dropping and habitually fell back to 11Kbps.

What I would recommend is to disable all security. Place the laptop physically next to the router and check the reported signal strength. Channels with problems will be reported as less than 100%. For example, I found with my laptop, that channel 1 only reported 70% when the laptop and router were within millimeters of one another.

Once you have a channel that reports 100% try connecting. Only once the connection is working reliably without security should you enable it, for say WPA-PSK.

If on attempt to connect with WPA-PSK you get a message like this in /var/log/NetworkManager:

 Nov 4 17:50:08 acer NetworkManager: <WARN> get_secrets_cb(): Couldn't get connection secrets: applet-device-wifi.c.1522
(get_secrets_dialog_response_cb):canceled.

Hardware

Atheros

Note: after initially trying this guide on an ibm t43p it would not work with the default version of ndiswrapper. I had to download the latest version (1.43 stable) and compile / make / make install. I then had to add the line "modprobe ndiswrapper" to the beginning of /etc/rc.d/network to get it to start on boot.

Further Note: Don't forget, if you end up updating your opensuse system so you are running a new kernel, you will have to recompile ndiswrapper again.

For the AR5005G (frequently used in laptops) you will need a more recent of the windows drivers. If you have access to the installation under windows you can copy the drivers from C:\Program Files\Atheros\Driver

# become root
su 

# check whether compatible hardware is installed
lspci  | grep AR5212 

# install ndiswrapper via regular yast methods

yast2 -i ndiswrapper ndiswrapper-kmp-default

# download atheros NDIS driver. (you can also try to extract it from the Windows Driver CD)
wget http://cdgenp01.csd.toshiba.com/content/support/downloads/atheros_wpa_driver.exe
or if you are using the 64bit version (x86_64) you will need the driver for 64 bits
wget http://76.8.192.78/test/atheros64wireless.zip

# install atheros binary driver
unzip atheros_wpa_driver.exe (or atheros64wireless.zip) 
ndiswrapper -i net5211.inf 

# load kernel module
modprobe ndiswrapper

# check output for errors
dmesg | grep ndiswrapper 

# reboot if necessary

# finally, bring network interface up
ifup wlan0

# use NetworkManager applet to connect


You can also configure it via YaST2:

 Start YaST Lan Module
 "Add" a new card.
 Set "Device Type" to "Wireless"
 Set "Module Name" to "ndiswrapper"

 Image:Ndiswrapperconfig2.png

 Then configure the rest of card as usual (or let NetworkManager do the rest).

Extra Information


The easiest and best way to get the Atheros WLAN card to work is to use madwifi. See Atheros madwifi for more information. If all fails, you can try ndiswrapper.



The release notes of SUSE Linux 10.1 say

The following kernel module package was changed internally:
   * Various drivers for wireless LAN cards. The madwifi driver for Atheros WLAN cards was removed.


You can either use the downloads for the driver as described here or use the ndiswrapper as described above.

See Also


External Links


Passed QA check: --Shayon 16:20, 20 October 2009 (UTC)