# [S] net.ath0 + atheros + madwifi can't find AP (no scanning)

## robot

Hi all,

I've been trying to work this one out for days and it's driving me up the wall.

I emerged the new baselayout + wireless scripts as outlined in the new wireless guide.

I have an IBM Thinkpad T42p with an Atheros a/b/g chipset and am using the Madwifi drivers (I've tried both the portage ones and the CVS ones).

I have a WEP-less access point that broadcasts it's SSID and am using dhcp. This should be a really straightforward setup, in theory, requiring little if no changes in /etc/conf.d/wireless, right?

I can set up my connection manually without any problems:

```
ifconfig ath0 up

iwconfig ath0 essid MYSSIDHERE

dhcpcd ath0
```

This works a charm.

If I do rc-update add net.ath0 default, the script gets executed, but reports that it couldn't find any APs, because ath0 does not support scanning. It suggests that I add them manually to the preferred list and use force_preferred.

Doing so gives me varying success. Sometimes it associates, sometimes it does not. I found that only if I set the sleep_scan_ath0 and sleep_associate_ath0 to really high (like 30) does it associate to a preferred AP on bootup. 

I also tried running iwlist ath0 scan, which sometimes works, and sometimes gives:

```
ath0    Failed to read scan data : Resource temporarily unavailable
```

The odd thing is that if I run net.ath0 start by hand after having logged in and simultaneously look at the output of iwconfig ath0, I can see that it does indeed associate with my AP (the little wireless light on the computer is on also), but the script still fails. It seems like there's something wrong (perhaps with DHCP?) that prevents it from completing successfully. 

BTW, I've set iface_ath0="dhcp" and the dhcpcd_ath0 options in /etc/conf.d/net

I'm really desperate. Right now I have to wait forever every time it boots just to have it associate with pre-defined SSIDs. Either that, or do everything by hand every time.

Any help would be greatly appreciated!

Cheers!Last edited by robot on Sun Feb 06, 2005 12:19 am; edited 1 time in total

----------

## mrpdaemon

Have the same setup over here (IBM T42p, great laptop).

Instead of using gentoo's wireless scripts you might want to add the manual stuff to /etc/conf.d/local.start and it will get executed with the 'local' service (last in boot order).

Also, you might want to make these thing run backgrounded so that you don't have to wait for wireless to associate for loading X, getting a login screen etc. Basically you might create a new script, /root/bin/my-wireless or something, and add your stuff in there, then add:

```
/root/bin/my-wireless &
```

to /etc/conf.d/local.start

Hope it helps.

----------

## robot

Finally, after weeks of frustration, I was finally able to solve this. I'm posting my solution because it might be useful to any t42p / atheros abg owners out there.

It seems that the Atheros needs more time to scan all three bands (a/b/g), thus timing out with the default timeout values in the wireless-tools up to version 27 (the culprit being iwlist ath0 scan).

Luckily, I came across this thread on the wireless-tools list: http://sourceforge.net/mailarchive/forum.php?thread_id=5966999&forum_id=33958

Jean Tourrilhes increase the timeouts in 28-pre3 onwards, to make it work with the Atheros chipset. Since portage still only carries 27, I grabbed the latest tar from:  http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/

and did make, make install (all of this after unmerging my old wireless-tools) and it now works beautifully with the "wireless the gentoo way" startup scripts.

Once v. 28 of wireless-tools is included in portage, this should take care of itself. Til then, just grab and make the sources.

Hope this helps people![/url]

----------

## Sm1

I am having the exact same problem you did, but  I found that wireless-tools-v28 pre4 is in portage now.  The problem still seems to be occuring for me however.  Was there anythign else you had to do for this to work correctly?

----------

## robot

Not that I can think of off the top of my head...

I didn't try the portage version. Did you try downloading the tarball from Jean's page? 

I might try to emerge the portage version when I get home tonight, to see if I get the same error.

----------

## Sm1

Actually this is the first time I am trying wireless here, and it looks like at work they don't allow anything but very specific cisco cards that support LEAP.  I might be sol here, but I'll try it at home later on this evening as well ( it might actually work there)

----------

## Sm1

Now I tried the wireless at home where I know for a fact the access point will allow me in.  I disabled wep just to try to simplify things.  Still i can scan and see my access point in the scan list but it won't connect, even if I force a mac address and ssid down iwconfig's throat.  

I tried to recompile madwifi from cvs to see if maybe it would help, when I did notice that there were warnings about ieee80211_iterate_nodes and ether_sprintf missing for ath_rate_onoe.  I tried to redo the CVS build using ath_rate_mtrr, and still it told me both were missing.  I double checked the ebuild and the same thing was happenening.

Now I read the faqs and double checked to make sure module versioning was off (it was) and that I had all the appropriate kernel options.  Then I saw something on a forum that kernel 2.6.10 had some issues with this, so I reverted back to kernel 2.6.9-r9, still not a single bit of luck.  

Until I get this working, I picked up a cheapo dlink pcmcia dwl650 revP, which works find with linux-wlan-ng drivers.

Any more ideas what I can do here?

----------

## Sm1

OKay i have a really ODD fix herel, but I got it working and I'll post it so everyone else can have an idea of what to do if this happens to them.  I compiled CVS - the ath_rate/onoe directory first, followed by the ieee802111 directory.  Lastly I compiled the based directory.  For some reason, this order posed no warnings & everything seems to work as it should when I did a make install.

----------

## biner

 *Sm1 wrote:*   

> OKay i have a really ODD fix herel, but I got it working and I'll post it so everyone else can have an idea of what to do if this happens to them.  I compiled CVS - the ath_rate/onoe directory first, followed by the ieee802111 directory.  Lastly I compiled the based directory.  For some reason, this order posed no warnings & everything seems to work as it should when I did a make install.

 

I was in the same boat as you. Brand new NC8000 laptop and Atheros based card, and couldn't get the wifi working. I have "patched" the ebuild to reorder the building of the modules. It seems that the the wlan (net80211) module needs to be built before the ath_rate/onoe, or the latter will complain. I re-emerged it and all is well now. Just put this ebuild in your overlay directory, and you should be set. It also uses the 20050219 version of the madwifi-driver.

Hope that helps.

```

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-wireless/madwifi-driver/madwifi-driver-0.1_pre2005xxxx.ebuild,v 1.3 2005/01/10 04:12:17 solar Exp $

inherit linux-mod

DESCRIPTION="Wireless driver for Atheros chipset a/b/g cards"

HOMEPAGE="http://madwifi.sourceforge.net/"

SRC_URI="http://madwifi.otaku42.de/${PV:7:4}/${PV:11:2}/madwifi-cvs-snapshot-${PV:7:4}-${PV:11:2}-${PV:13:2}.tar.bz2"

LICENSE="GPL-2"

KEYWORDS="~x86 ~amd64"

IUSE=""

DEPEND="app-arch/sharutils"

RDEPEND=""

S=${WORKDIR}/madwifi

pkg_setup() {

        linux-mod_pkg_setup

        use x86 && TARGET=i386-elf

        use amd64 && TARGET=x86_64-elf

        MODULE_NAMES="ath_hal(net:${S}/ath_hal) wlan(net:${S}/net80211) wlan_acl(net:${S}/net80211)

                wlan_ccmp(net:${S}/net80211) wlan_tkip(net:${S}/net80211) wlan_wep(net:${S}/net80211)

                wlan_xauth(net:${S}/net80211) ath_rate_onoe(net:${S}/ath_rate/onoe) ath_pci(net:${S}/ath)"

        BUILD_PARAMS="KERNELPATH=${ROOT}${KV_DIR} KERNELRELEASE=${KV_FULL}

                TARGET=${TARGET} TOOLPREFIX=/usr/bin/"

        BUILD_TARGETS="all"

}

src_unpack() {

        unpack ${A}

        for dir in ath ath_hal net80211 ath_rate/amrr ath_rate/onoe; do

                convert_to_m ${S}/${dir}/Makefile

        done

}

src_install() {

        dodoc README COPYRIGHT

        linux-mod_src_install

}

pkg_postinst() {

        linux-mod_pkg_postinst

        einfo ""

        einfo "The madwifi drivers create an interface named 'athX'"

        einfo "Create /etc/init.d/net.ath0 and add a line for athX"

        einfo "in /etc/conf.d/net like 'iface_ath0=\"dhcp\"'"

        einfo ""

}

```

----------

