# [Solved] Configuring ath5k atheros wifi through openrc

## eccerr0r

Has anyone lately tried configuring ath5k through openrc lately?

Currently trying to rule out a hardware problem.

Situation: I have a AR5212/AR5213 miniPCI wifi card.  I can run it just fine in my full laptop - removing the IPW2200BG and sticking the card in, and the card seems to work.  I'm using NetworkManager on this computer and it configures the wireless just fine.

Then I move this miniPCI card to a single board computer.  The miniPCI card enumerates and modprobe ath5k works just fine.

The dmesg log of both machines look very similar on startup.

I can iwconfig this device and it looks just fine:

```
# ifconfig wlan0 up

# iwconfig wlan0

wlan0     IEEE 802.11bg  ESSID:off/any

          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm

          Retry  long limit:7   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off
```

However this is where the similarity ends.  When I run

```
iwlist scan
```

The laptop reports the usual wifi AP's nearby including my own.  However in the single board computer it reports

```
wlan0     No scan results
```

Is there anything special that needs to be done to enable the radio so that it could pick up APs nearby?

----------

## szatox

You probably didn't compile legacy wireless-extensions module.

It's not necessary anymore since you most likely have wpa_supplicant anyway and you can use wpa_cli to trigger scan and retrieve results. You can also use iw to do that.

For maual configuration iwconfig and friends is more convenient way though. I think the wireless extensions module is under networking support -> wireless.

Try it

----------

## eccerr0r

CONFIG_CFG80211_WEXT is defined in the kernel settings.

I was trying with wpa_supplicant and it would never find my WPA2 AP, so I was hoping that iwlist scan to see if it finds anything...

```
# /etc/init.d/wpa_supplicant start

 * Starting WPA Supplicant Daemon ...Successfully initialized wpa_supplicant

 [ ok ]

# sleep 10

# wpa_cli scan_results

Selected interface 'wlan0'

bssid / frequency / signal level / flags / ssid

#

```

Hmm...

----------

## szatox

Ops.. I've just realised I sent this message in wrong place.

In fact it is possible that rfkill stands on your way, you can check it with

 *Quote:*   

> 
> 
> cat /sys/class/rfkill/rfkill0/{soft,hard}

  (1 means blocked)

Also, what channel are you using? Your wifi is probably set to some particular region by factory defaults, and ath5k sets allowed channels to match allowed range. If your AP is not within this range, your adapter might not see it. (even though it would switch to AP's zone after connecting)

AFAIR this behaviour was different with much older ath5k.

Also, since it's miniPCI, what about antenna? Is it printed on PCB or perhaps stuffed somewhere behind your laptop's screen so you detach it when moving to another device?  :Smile: 

----------

## eccerr0r

rfkill0/soft and rfkill0/hard are 0.

rfkill0/state is 1, not sure what that means.

I don't recall what channel my AP was using.  It's in the standard US range from 1 through 11 somewhere, likely channel 6.  I wonder if this card is scanning in the 1-11 range and not checking in the 5GHz range (it wasn't really clear if this AR5212/5213 supports 802.11a or not...  Then again I don't have other 802.11a 5GHz equipment.)

Oddly enough the same card does pick up my AP with a very strong signal when installed in the laptop with a full NetworkManager setup.  The AP is within 6 feet or so of my work area, which may be of concern to the next problem:

Antennas are definitely a concern.  While in the laptop I was using the laptop's antennas which are probably pretty good, but no, I don't have standard antennas for my target, non-laptop platform - I have 6 inch pieces of 30 ga Kynar (full wave antennas, since wavelength is about 12cm) to both the main and aux ports and keep them face up.  Even if they aren't the most efficient they should pick up and transmit *something*.  I did this same trick before with an old Orinoco miniPCI and it worked fine in a laptop that didn't have a built-in antenna system with slightly less range.  I may have to try running the laptop with the Atheros with these jury-rigged wire antennas to rule out the poor antenna possibility.

Another observation is that running hostapd doesn't work due to some initialization problem of nl80211.  May also be related, but I didn't try hostapd on the Networkmanager setup.

For the curious:

The "target" platform is a AMD SC520 Single Board Computer with a miniPCI slot.  I think it was part of an old router that someone parted.  It has 64MB RAM so it probably isn't a good idea to install networkmanager on it :)

----------

## eccerr0r

I think this is solved now, sort of.

This is a hardware problem of sorts.  When I plugged in a Cardbus PCMCIA card and it works with the OpenRC config with no additional modification.

*shrug* this is weird.

----------

