Samstag, 4. Februar 2012

[Update 4] Ubuntu + TP-Link TL821Nv3 / TL822N v2.0

After I upgraded my Ubuntu 11.04 to 11.10 due to the upcoming 12.04 version (which I won't upgrade to anymore because of their Unity crap, just a personal rant btw) I had massive problems with my not-so-old TP-Link TL821Nv3 wireless USB-stick which worked fine most of the time all day long.

Now, for those of you who also have problems with this stick: Be aware that there are different versions of  TL821N / TL822N around: On the retail package there are very small version numbers (such as v3 or v2.0) printed on.

Okay, so after having that much trouble with my formerly bought TL821Nv3, I decided to go with the TL822N because of reports that this stick has a slightly different chipset on it. A few days later the new stick arrived and I did some basic lookup using "lsusb" on it: Crap, the very same chipset (0cf3:7015, ath9k_htc) on it as on my former TL821Nv3! They must have changed the chipset between revisions, because older reports claim they used a different Aheros chipset on this stick before. Bad luck for me move on.

After doing some more research I thought it would be worth trying out the latest ath9k_htc driver from the Linux 3.3 kernel (Ubuntu's stock kernel with 11.10 is btw) -- so digging further into the Linux Wireless Project. Here you can get a source package with the latest (stable?) drivers which come with the stated kernel. For getting a list of all current releases, take a look here.

So - finally, after a lot of text - here comes a small how-to for building and installing the latest ath9k_htc driver from the Linux 3.3 kernel on your Ubuntu (also should work on the Linux Mint/Kubuntu/you-name-it equivalents):

  1. First, verify that you're still using the old ath9k_htc module by doing a "modinfo ath9k_htc". The old driver's path in "filename" should point to "3.0.0.something" and the path should contain "kernel/drivers".
  2. Do a "sudo apt-get install --reinstall linux-headers-$(uname -r) build-essential" for installing the required build tools and Linux headers.
  3. Download the latest Linux Wireless package (at the time of writing this is 3.3-rc1-2) by doing a "wget".
  4. Unpack it: "tar xvjf compat-wireless-3.3-rc1-2.tar.bz2".
  5. Go into that directory: "cd compat-wireless-3.3-rc1-2".
  6. Select the correct driver(s) to build by doing a "scripts/driver-select atheros".
  7. Finally, build the stuff by just doing a "make".
  8. After the stuff got built, install the newly built drivers and unload the old ones with "sudo make install && sudo make wlunload".
  9. Verify again that now the new driver got loaded by doing a "modprobe ath9k_htc".  In the filename field the path now should contain "updates/drivers" instead of "kernel/drivers" (as pointed out in step 1).
Update: If connections are still dropping, try disabling the power management of the USB stick by doing a "sudo iwconfig wlan0 power off", where "wlan0" represents your configured wireless device bound to the USB stick.

Update 2: After some more reading about the TP-Link sticks I get the impression they appear to have an overheating problem. Some users even opened their stick cases and added a small passive cooler to the main chip on the logic board. Another option that might help to cool down the stick a bit when processing a lot of wireless traffic is to add "options ath9k_htc nohwcrypt=1" to a newly created file named "ath9k_htc.conf" in the directory "/etc/modprobe.d/". After that just reload the modules or simply do a reboot of your machine.

Update 3: In case the above still doesn't work for you all day long (that's how it is for me -- it works okay, but not through and through yet), here's a simple sudo script called "" which does all the teardown work for you to re-initialize all the stuff to get it back working again:
ifdown wlan0
rmmod ath9k_htc
rmmod ath9k_common
rmmod ath9k_hw
rmmod ath
rmmod mac80211
rmmod cfg80211
pkill wpa_supplicant
ifup wlan0
If, for whatever reason dmesg tells you "Registered led device: ath9k_htc-phyX", where "phyX" in a higher number (let's say > 10) then there is little chance to get the damn stick working again without reloading the modules mac80211 and cfg80211 (which does the script above already).

Update 4: Seems like there were a lot of changes in the 3.4-rc3 compat package (see Changelog). While the USB stick still is not running 100% perfect I'm giving 3.4-rc3 a go on my not-yet-updated Ubuntu 11.10. Go an grab the new compat package here.

Let me know if/how it's working out for you!

Good luck!

3 Kommentare:

Valerio hat gesagt…

Hi, thank you for this post.
I tried and tried, but couldn't make my TL821N usb wireless adapter work on Ubuntu server 12.04.
The symptom is that it works well for a short time, but as soon as some Megabytes are transferred, it hangs.
Physically, either the green light on the dongle switches off, or it remains switched on without blinking.
I tried the default driver, the compat-wireless 3.3 and 3.4, and all the fixes I could find here and googling. I even tried the Windows drivers with ndiswrapper (ugh).
At first glance, it doesn't seem to be an overheating problem, sometimes the dongle gets hot, some other times it doesn't.

Did you eventually make it work?

shintoist hat gesagt…

On Linux Mint 13 on mature notebook, tp-link-tl821n dongle only connected closer than 2 meters to the router. Connections lasted for less than a minute before it started to hang. When I used a V-cable for USB extension connecting into 2 USB plugs, I could bring the dongle even closer to gain another minute before wlan disconnected. After installing wondershaper and running it with "sudo wondershaper eth0 1000 100", connection worked slower, but much more stable. No hang up.

shintoist hat gesagt…

Update, after 1 hour online with the tp-link dongle, wlan connection hangs up only when the webbrowser starts downloading something like an mp3 file or when it opens a website that contains larger content to download, like flash-videos, many ads, etc. Free operating systems are very convenient this way to avoid the Internet as much as possible and read a book, not an ebook, of cause.

Kommentar veröffentlichen