I felt this community could use a tutorial concerning installing latest wireless cards. As we all know wireless
cards tend to not be supported alot under linux, although vendors seem to slowly get the message that we,
linuxers, can't be denied anymore.

Anyway, as i said a bunch of cards still aren't officially supported, and if they are only for windows or Mac.
Here's where ndiswrapper comes around the corner.

Ndiswrapper is a project focusing on those unsupported cards, as my Linksys WPC54G pcmcia card. This card uses the
Broadcom wireless chip and will be my reference through out this tut. My OS is gentoo and my kernel is 2.6.7 rev 11
, but i tried as good as possible to generalize the tut for other linux distro's.

First we need to see if ndiswrapper supports our nic. Therefore we need to know what chip it uses.
If its nowhere on the package or so, we can use lspci to detect it.
Its important that it even gets detected, so don't skip this step and make sure it detects it,
and if it not gets detected, make sure you have Wireless Lan support and pcmcia support compiled in your kernel.
While you're at it disable support for SMP in kernel.

Also if you don't have lspci, download and install pciutils (or via your distro's package manager).

 	root@S04200 /home/n300851 # lspci
	0000:03:00.0 Network controller: Broadcom Corporation  802.11g (rev 03)
This is my chip. Also notice further info on the type of chip (BCM94306). Remember or write this down.

Now we have this info, we can go and check if our card is supported by ndiswrapper.
Go to this page : http://ndiswrapper.sourceforge.net/s..._chipsets.html

OK, we are sure our card got supported and we know the references to use. For me it would be the "bcmwl5.*" driver-set.
Mostly it will be the same as the windows drivers, but I'd urge you to take the set found at the ndiswrapper site.
Download and extract that package in a directory (doesn't matter where). We'll need it for later use.

Now we need to install an important package which will make the management of your wireless preferences easier.
Got to this page, http://www.hpl.hp.com/personal/Jean_...nux/Tools.html and download the wireless-tools package.

I always use wget. Of course make sure you get the latest tarballs . This can differ from this tut

#wget http://pcmcia-cs.sourceforge.net/ftp...ools.26.tar.gz
#tar xvzf wireless_tools.26.tar.gz
#cd wireless_tools.26
wireless_tools.26#make install
After this is done without errors, we're gonna setup ndiswrapper itself. In this example I use the Dublin-mirror, You can use a closer mirror though. Your choice ... Of course make sure you get the latest tarballs . This can differ from this tut

#wget http://heanet.dl.sourceforge.net/sou...er-0.10.tar.gz
#tar xvzf ndiswrapper-0.10.tar.gz
#cd ndiswrapper-0.10
ndiswrapper-0.10#make install
If this worked out, we're half way ...

Remember we checked our chip later on, and I asked you to download that particular set of drivers. If you were good
you extracted it already.
Now, make a directory /lib/windrivers and copy the .sys and the .inf from that package into the /lib/windrivers directory.
(example bcmwl5.sys and bcmwl5.inf)

#mkdir /lib/windrivers
#cd <to-dir-where-extracted-driver-package>
<dir>#cp <driver>.inf /lib/windrivers
<dir>#cp <driver>.sys /lib/windrivers
What we're gonna do know is actually wrap the windows-driver using ndiswrapper.

#ndiswrapper -i /lib/windrivers/<driver>.inf
Verify if ndiswrapper loaded your driver correctly. You should see something like this.

#ndiswrapper -l
Installed ndis drivers:
bcmwl5 present
Load the ndiswrapper as a module in your system

#modprobe ndiswrapper
If everything went good, you should see it loaded, and you should see your wireless nic with a dmesg

# lsmod | grep ndiswrapper
ndiswrapper            72448  0
# dmesg | grep wlan
wlan0: ndiswrapper ethernet device 00:0f:66:54:61:91 using driver bcmwl5.sys
If you have problems here check especially your kernel, and the detection of your wireless card.
Now If this did work, we want this to be done automatic on boot next time.

#echo "ndiswrapper" >> /etc/modules.autoload.d/kernel-<version>
Of course your version of kernel where <version>. (kernel-2.6 or kernel-2.4).
At this moment the wireless card should function at default values, that is without wep and such. Next I will briefly
show how to configure the card to your wishes and network. This is where those wireless-tools kick in.

ok, lemme first show you how to lookup current configuration. This WILL differ with mine cause mine is already configured

wlan0     IEEE 802.11g  ESSID:"*******"  
          Mode:Managed  Frequency:2.472GHz  Access Point: 00:0B:6B:30:**:**  
          Bit Rate:54Mb/s   Tx-Power:14 dBm   
          RTS thr:2347 B   Fragment thr:2346 B   
          Encryption key: off
          Power Management: off
          Link Quality:100/100  Signal level:-27 dBm  Noise level:-256 dBm
          Rx invalid nwid: 0  Rx invalid crypt: 0  Rx invalid frag: 0
          Tx excessive retries:9  Invalid misc:79919   Missed beacon: 0
So here you see your current settings, now you need to tweak to yours. If you have problems setting things,
consider the "--help"-function on a command. (for.ex. #iwconfig --help will give you short help on the usage)

The most important commands you need are iwlist and iwconfig. Lets for example scan the network now, for available
networks. Also check its manpages (#man iwconfig and #man iwlist)

# iwlist scanning
lo        Interface doesn't support scanning.

eth0      Interface doesn't support scanning.

eth1      Interface doesn't support scanning.

wlan0     Scan completed :
          Cell 01 - Address: 00:0B:6B:30:**:**
                    Protocol:IEEE 802.11b
                    Frequency:2.472GHz (channel 13)
                    Quality: 0/100  Signal level:-27 dBm  Noise level:-256 dBm
                    Encryption key: off
                    Bit Rate:1Mb/s
                    Bit Rate:2Mb/s
                    Bit Rate:5.5Mb/s
                    Bit Rate:11Mb/s
                    Bit Rate:6Mb/s
                    Bit Rate:9Mb/s
                    Bit Rate:12Mb/s
                    Bit Rate:18Mb/s
                    Bit Rate:24Mb/s
                    Bit Rate:36Mb/s
                    Bit Rate:48Mb/s
                    Bit Rate:54Mb/s
As you can see you now know the current settings of your card and the network, so now go and configure your card
to the according network. Here are some examples ...

#iwconfig wlan0 essid on
#iwconfig wlan0 freq <2.****>
#iwconfig wlan0 chan <channel>
#iwconfig wlan0 enc <encryption-key>
#iwconfig wlan0 nwid <network-id>
These are the more common settings. Surely "man iwconfig" is still at your disposal. So consider checking out the manpage
It's there for a reason, cause i can't talk over every single possibility.

Now last to bring up the nic. Don't forget to make an additional conf for your wlan0 interface. For me that would be to copy the conf file of eth0 into a conf file for wlan0.

#ifconfig wlan0 up
#dhcpcd wlan0
Of course this can be automated. I found and adapted a script. Now i know its a gentoo-like script.
Maybe some other linuxlover here can adapt this better. For me on gentoo its #!/sbin/runscript, but I believe for other
distros a #!/bin/bash will do. Not sure of this one tho.

Here's my script which i place in the correct runlevel. Cause i work with a pcmcia it also first goes and detect
the card first. If you can scroll back, you'll see my nic situates at hardware adress 0000:03:00.0.
I'm not going into this script deeper. That's up to you. If you need me, you can find me on my IRC.


state=`lspci | grep 03:00`

start() {
if [ "$state" = "" ];
                ebegin "No Wireless adapter present."
                eend 0

                ebegin "PCMCIA Wireless adapter found."
                eend 0
                ebegin "Initializing wireless network ..."
                `/usr/sbin/iwconfig wlan0 essid <network-id>`
                `/usr/sbin/iwconfig wlan0 key <my-encrypted-key>`
		`<other options here if needed>
                eend 0


stop() {

ebegin "Stopping wireless network ..."
eend 0
If things are wrong or can be done better, please PM me and i'll change it in the tut.

Hope this works for you,

Peace I'm out.