# Setup-Guide for WLAN on IBM Thinkpad T40p

## BloodyNewbie

Setup Guide for WLAN on IBM Thinkpad T40p :

Be aware, that we are working here with the onboard 

PCI Card is IBM a/b 168c:0012 (rev1) 

BUT this little howto SHOULD work with other (atheros based) cards as well!

get the newest kernel (2.6.8.1 now) and add the following in menuconfig:

```

Power management options:

   -ACPI everything "y"

   -AMP "n"

Device Drivers/Networking Support "y"

Device Drivers/Networking Support/Network Device Support/Wireless LAN/Wireless LAN drivers "y"

Device Drivers/Networking Support/Network Device Support/Wireless LAN/everything else "m"

```

wireless-tools

```

emerge wireless-tools

```

 

follow the first posting of the thread by Uberlord https://forums.gentoo.org/viewtopic.php?t=122435

Now we need the appropriate Driver(Madwifi for Atheros Chipset)

```

mkdir /usr/local/portage/net-wireless/madwifi-cvs

cd /usr/local/portage/net-wireless/madwifi-cvs

wget http://gentoo.cipheralgo.org/madwifi-cvs-XXX.ebuild //XXX stands for the newest ebuild, go see under http://gentoo.cipheralgo.org)

ebuild madwifi-cvs-XXX.ebuild digest

echo "net-wireless/madwifi-cvs ~x86" >> /etc/portage/package.keywords

echo ">=net-wireless/madwifi-cvs-0.3" >> /etc/portage/package.unmask

emerge madwifi-cvs

```

if you have your /etc/conf.d/wireless configured(you need at least: mode_ath0="managed" preferred_aps=( "your ESSID" ) then:

```

ifconfig ath0 up

```

and then cross fingers(and stop any other interface like eth0 before):

```

/etc/init.d/net.ath0 start

```

A problem is: You can scan for AP's with "iwlist ath0 scan" but not with "net.ath0 start" (I already wrote an email to the madwifi devs), that's why we need preferred_aps.

So scan your wanted AP via iwlist and then connect to it.

If you can't ping any host afterwards, try

```
dhcpcd ath0
```

 first, to get an IP.

Thus far, have a nice day

----------

## UberLord

Please note - the current madwifi driver in ~x86 (madwifi-driver-0.1_pre20040824-r1) works fine with my WG311 for scanning and my script.

This is the only instance of a madwifi-driver based card I know of that doesn't work with my script for scanning.

preferred_aps=( "ESSID1" "ESSID2" )

works fine though  :Smile: 

----------

## illusion

I have the same wireless card, although in an IBM ThinkPad R40.

However, when working with a 2.6.8.1 kernel, and the madwifi-cvs drivers, much as described here, and in Uberlord's post... I have been completely unsuccessful in getting my card to scan the network at all, much less in net.ath0... This is a huge problem for me because I am at a University where I am moving between buildings in a large and diverse wireless network, and thus need to have scanning active, as I can never know what access point I am going to want to connect to. Any ideas? I am currently trying to backtrack to an older version of the drivers to find one that works correctly.

kernel: 2.6.8.1-ck6

madwifi-cvs: 0.3-r1

-cc

----------

## BloodyNewbie

illusion: what is the error you get when trying to scan for AP's?

I use the same versions as you do, but it works, except one thing:

I can't use signal strength in mode=monitor. ( be sure to come out of monitored mode!! sometimes kismet(scanning software) messes up and stays in that mode!)

But I have to post here, that when I go for /etc/init.d/net.ath0 start

Sometimes it finds accesspoints, sometimes it says there are none and sometimes it says, that the interface wouldn't support scanning at all(BUT it DOES!!).*all these mesures, I got from ONE single point, right next to my AP!

So I began to hate it and consider the whole as randomly working.

But in my case, I think it is because of a crappy AccessPoint, too.

Tip: iwlist ath0 scan

if: card doesn't support scanning//no ap's in range.. then you could set the timeout a bit higher

the second try is most of the time a win, I see all AP's nearby.

if not: I do ifconfig ath0 up (if it still doesn't work)

MOST of the time it works then.

I am also at a big university with lots of nodes, so I always have to switch the AP from one building to another, this is crappy, but with automatic connection to the stronges AP and a wide blacklist of AP's around that don't belong to the university, it works good(especially because we only use vpn(virtual private network) and no WEP's.

My last tip is: emerge kismet and try it, if you see, that it works, then the scanning problem is because of the configScript, you might try the script (now newly in portage) from Uberlord under his thread(wireless config, the gentoo way).

and the very last tip:

http://gentoo.cipheralgo.org/

cipher made a new ebuild, yesterday, maybe you wanna give it a try, well he just added one variable, I don't know about the influence of that.. *g

greets

bloodyNewbie

----------

## Rafje

Re madwifi not supporting scanning

I had the same problem: scanning didn't work anymore with 2.6.8-gentoo-r3/madwifi-driver-0.1_pre20040906/wireless config in baselayout, whereas it did work fine with 2.6.7-gentoo-r11/madwifi-driver-$some_older_version/standalone wireless config scripts.

But thanks to the clues in this post, I managed to force madwifi into scanning. I have this configured in /etc/conf.d/wireless:

```
[...]

scan_mode_ath0="Managed $(ifconfig ath0 up 2>&1 >/dev/null) $(iwconfig ath0 channel 11 2>&1 >/dev/null)"

[...]
```

(Everything is configured on one line.)

This sets up the wireless card so that it supports scanning, and it does this just before the wireless config scripts ask the card to scan.

I know it's a very dirty hack, but it did the trick for me.

Cheers

----------

## MrStaticVoid

 *Rafje wrote:*   

> 
> 
> ```
> [...]
> 
> ...

 

THANK YOU SO MUCH!!!  I have been having this problem for a while now and getting the source from CVS hasn't helped.  Your hack worked for me...now if only there was an actual fix...

EDIT:  BTW... I am using an IBM a/b/g mpci card in my T41p.

----------

## Rafje

 *Mr. Static Void wrote:*   

> BTW... I am using an IBM a/b/g mpci card in my T41p.

 

Yep, same here (well, T40p to be precise). It seems to me that the scanning problems are specific to the IBM a/b/g thingy, because the DWL-G520 card in my desktop uses the same version of the madwifi driver, and it scans without my ugly hack.

Oh well...

----------

## MrStaticVoid

I went back to the last working version of the madwifi-drivers (20040726) because, even though your hacked allowed it to scan at boot, it did not fix the iwlist ath0 scan command.    :Sad: 

This is bad...I guess I should submit a bugreport with the madwifi project.

----------

## kung.foo

I do also have a T40p, the only problem is right now that i can't build the newest version of the driver for ANY kernel (some error during make).

I can also not load the older drivers (that can be built) under 2.6.9, because ifconfig does not quite bring up the interface and when doing ifconfig ath0 down, it segfaults.

Any ideas?

----------

## wildcart

 *Rafje wrote:*   

> Re madwifi not supporting scanning
> 
> I have this configured in /etc/conf.d/wireless:
> 
> ```
> ...

 

This seems to be working 'great', at least if your channel is 11. Mine is 5 so I changed the second command to ... channel 5 2>&1... and it's working for me. I don't know much about the channel stuff, but if it sometimes is 11 or 5 or what so ever, its no use at all to specify the channel in the config file. If I do that I could also setup essid_ath0="myessid" which would be much easier then specifying the channel. In other words whenever I change networks I have to change the config file. This I don't want to do!

Some words about my setup / problem:

IBM Thinkpad x40

atheros AR5212 802.11abg

kernel 2.6.10

baselayout 1.11.9

wireless-tools 27

madwifi-driver-0.1_pre20050224

- /etc/conf.d/wirelss is empty -

- keywords="x86", where needed I set "~x86" on a per package base in /etc/portage -

The problem is that whenever I try to start net.ath0 I get an error message that the interface does not support scanning and that I should set preferred_aps. In this case the example wireless file suggests to set essid_ath0 to "any". Did that and after a few seconds net.ath0 aborts with  'Failed to configure wireless for ath0'. I get the same error message if I set up a wrong essid in /etc/conf.d/wireless.

The madwifi README tells me that I have to run `ifconfig ath0 up` in order to use `iwlist ath0 scan`. So I wonder if the wireless config scripts are running this command because if I don't up ath0 before running `iwlist ath0 scan` I get an error saying the interface doesn't support scanning.

When I run `ifconfig ath0 up` manually, `iwlist ath0 scan` is working as expacted, showing the available APs. 

I also followed the thread at https://forums.gentoo.org/viewtopic-t-122435-postdays-0-postorder-asc-start-1350.html and found the problem described there, but no real solution, only a link to this thread.

Since both threads didn't get updated the last couple of months I post my problem here. Right now I try to figure out how the wireless-tools are working and if there is any way to fix this...

May be I am not seeing the obvious. In this case, please kindly point me the right directory...

Chriss

P.S. the scanning for APs/ESSIDs is working on SuSE 9.2 with the same driver (and earlier ones)

----------

## wildcart

I figured out a 'better' way to solve the problem.

I patched the file /lib/rcscripts/net.modules.d/iwconfig with the following code:

```

if [[ -z $scan ]]; then

  ewarn "${iface} scanning failed. Maybe ${iface} needs to be up for scanning"

  ifconfig $IFACE up

  local scan=$( iwlist ${iface} scanning 2>/dev/null )

fi

```

This code needs to be added to the iwconfig_scan function just after the first 'local scan=$( ... )' line.

It seems to work on my computer. /etc/conf.d/wirless is empty and I can connect to my wireless lan and write this message. Right now I can't say if it is working on any thing else besides my laptop with my wireless card / driver combination. Also it's not very clean. Maybe I should add an option ifup_IFACE=0|1 to /etc/conf.d/wireless.

I will contact the author of the wireless config scripts and ask him what to do. 

Chriss

----------

