# ath9k device recognized but unable to connect or scan

## Zivarah

Hello,

I have recently purchased a TP-link TL-WN822N wireless N USB adapter on the basis that its atheros chipset is pretty well supported.  I have installed the firmware and enabled the necessary settings in the kernel (see following).

The device is recognized as wlan0, however when I try to run a scan, I get the "scan not supported" error.  It cannot connect to or see any access points.

I am connecting without any kind of encryption or security (my school's system deals with permissions based on mac address after the computer has connected to the network).

note: as I was writing this post, I had to reboot into the kernel with the new atheros card to run some of the following commands.  This time, the device succesfully connected during the boot process, was able to scan, and operated properly for a few minutes.  It then disconnected randomly and even after a few reboots I was unable to coax it back to life. So, it's configured right, sort of? I'm pretty lost here.

I have spent a good deal of time trying various things including using wpa_supplicant and network manager.  With my old but poorly supported ralink card, I was able to connect and scan with no real issues aside from poor performance (open source ralink driver has no N functionality yet), and I've been trying all the same steps as I did with the old one (and a few others).  Any help would be greatly appreciated.

```
Kernel settings:

Networking Support --->

   Wireless --->

      <M>   cfg80211 - wireless configuration API

      [ ]     nl80211 testmode command

      [ ]     enable developer warnings

      [ ]     cfg80211 regulatory debugging

      [ ]     enable powersave by default

      [ ]     cfg80211 DebugFS entries

      [*]     cfg80211 wireless extensions compatibility

      [*]   Wireless extensions sysfs files

      <M>   Common routines for IEEE802.11 drivers

      [ ]   lib80211 debugging messages

      <M>   Generic IEEE 802.11 Networking Stack (mac80211)

           Default rate control algorithm (Minstrel)  --->

      [ ]   Enable mac80211 mesh networking (pre-802.11s) support

      -*-   Enable LED triggers

      [ ]   Export mac80211 internals in DebugFS

      [ ]   Select mac80211 debugging features  --->

Device Drivers  --->

   Network device support  --->

      Wireless LAN  --->

         Atheros Wireless Cards  --->

            [ ]   Atheros wireless debugging

            <M>   Atheros 5xxx wireless cards support

            [ ]     Atheros 5xxx debugging

            <M>   Atheros 802.11n wireless cards support

            [ ]     Atheros ath9k debugging

            <M>   Atheros HTC based wireless cards support

            [ ]     Atheros ath9k_htc debugging

            <M>   Atheros AR9170 802.11n USB support
```

```
Outputs:

$ lsusb

Bus 002 Device 002: ID 0cf3:1002 Atheros Communications, Inc. TP-Link TL-WN821N v2 [Atheros AR9001U-(2)NG]

$ lshw -class network

*-network:1 DISABLED                                                                                                                                                             

description: Wireless interface                                                                                                                                             

physical id: 2                                                                                                                                                              

bus info: usb@2:6                                                                                                                                                           

logical name: wlan0                                                                                                                                                         

serial: 74:ea:3a:93:a0:17                                                                                                                                                   

capabilities: ethernet physical wireless                                                                                                                                    

configuration: broadcast=yes driver=ar9170usb driverversion=2.6.36-gentoo-r5-brian-desktop firmware=N/A link=no multicast=yes wireless=IEEE 802.11bg

$ lsmod

ar9170usb              49847  0

mac80211              162163  1 ar9170usb

ath                     8668  1 ar9170usb

cfg80211              139613  3 ar9170usb,mac80211,ath

$ /etc/init.d/net.wlan0 restart                                                                                                                                 

* Starting wlan0                                                                                                                                                                  

*   Configuring wireless network for wlan0                                                                                                                                        

*   wlan0 does not support scanning                                                                                                                                               

*     no access points found                                                                                                                                                      

*   Trying to force preferred in case they are hidden                                                                                                                             

*   Failed to associate with any preferred access points on wlan0                                                                                                                 

*   Couldn't find any access points on wlan0                                                                                                                                      

*   Failed to configure wireless for wlan0

$ iwlist wlan0 scanning

wlan0     Interface doesn't support scanning : Network is down 

$ iwconfig                                                                                                                                                      

wlan0     IEEE 802.11bgn  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
```

----------

## Gusar

Only one idea: try the carl9170 driver instead of ar9170usb

----------

## Zivarah

Thanks for the quick response.

I looked into that but I didn't see an obvious easy way of getting it: wasn't in the portage tree or the kernel config (unless I'm blind), and I didn't see an overlay.  Is there an ebuild anywhere you can point me too, or will I have to manually build from source?

-Ziv

----------

## Gusar

It's in the kernel config, right under ar9170usb, though it seems starting with 2.6.37. gentoo-sources-2.6.37 is in ~arch, getting that is probably the easiest way to get carl9170.

----------

## Zivarah

Ah, I'm running 2.6.36-r5 at the moment. Alright, I'll work on that after class today, thank you for the help!

-Ziv

----------

## Zivarah

Well, it started working without any more changes. I'm quite confused, but it has been working and stable for several hours, so I won't fix what isn't broken anymore.

Thank you for the help, again, and I'll try the newer kernel/carl driver if this one gives me any more trouble.

-Ziv

----------

