New Atheros Module and Ubuntu

Published on Tuesday, September 22, 2009

I've been using Atheros for quite some time, and I've always liked the madwifi drivers. They allowed really easy switching into monitor mode, and decent levels of packet injection. However, since I'm mostly in an office now, instead of writing web apps in cafes and trying to score free internet, I don't really need anything fancy. My gentoo stage 1 (3?) days are over. I use Ubuntu, because I'm lazy, and it mostly works.

My new laptop (well, 1.5 year old laptop now, but still new in my eyes) gave me the option between an Intel card and a Atheros wifi card. I chose the Atheros card; then the ath5k module came out, and life has been turbulent ever since.

In summary: the ath5k driver in the 2.6.28 kernel, which is what Ubuntu 9.04 uses, isn't as up-to-date as the drivers in compat-wireless. Fancy that... This presents me with the option of compiling a new kernel specifically with it, or just installing compat-wireless. I'm lazy, so...

I'll get a few basic troubleshooting commands out of the way first. After updating the kernel I kept getting disconnected - it appeared I was associate/disassociating frequently.

# dmesg
...
2577.134060] wlan0: associated
[ 2580.984838] wlan0: disassociating by local choice (reason=3)
...



# lspci | grep Atheros
03:00.0 Ethernet controller: Atheros Communications Inc. AR5212 802.11abg NIC (rev 01)



# ping 192.168.1.1
...
64 bytes from 192.168.1.1: icmp_seq=2409 ttl=64 time=1.13 ms
64 bytes from 192.168.1.1: icmp_seq=2410 ttl=64 time=2236.61 ms
64 bytes from 192.168.1.1: icmp_seq=2411 ttl=64 time=4562.40 ms
64 bytes from 192.168.1.1: icmp_seq=2412 ttl=64 time=6521.868 ms
...


The steps to resolve are as follows:

  • 1) Make sure you have headers for your current kernel.
  • 2) Make sure you have ability to compile programs.
  • 3) Download and install compat-wireless
  • 4) Unload and load the module.


So, first, use Synapitc to get the latest kernel headers and the 'build-essential' packages.

Next, download the compat-wireless package. I needed to use one from a few weeks ago because I received the following error:

make -C /lib/modules/2.6.28-15-generic/build M=/usr/src/compat-wireless-2009-09-22 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.28-15-generic'
CC [M]  /usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.o
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c: In function 'b43_do_interrupt':
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:1888: error: 'IRQ_WAKE_THREAD' undeclared (first use in this function)
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:1888: error: (Each undeclared identifier is reported only once
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:1888: error: for each function it appears in.)
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c: In function 'b43_request_firmware':
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:2218: warning: format not a string literal and no format arguments
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c: In function 'b43_wireless_core_start':
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:3867: error: implicit declaration of function 'request_threaded_irq'
make[4]: *** [/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.o] Error 1
make[3]: *** [/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43] Error 2
make[2]: *** [/usr/src/compat-wireless-2009-09-22/drivers/net/wireless] Error 2
make[1]: *** [_module_/usr/src/compat-wireless-2009-09-22] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-15-generic'
make: *** [modules] Error 2


You can download a working 2009-09-05 set from orbit-lab.org

# tar -xpjf compat-wireless-2009-09-05.tar.bz2
# cd compat-wireless-2009-09-05
# make
# make install
# make unload
# modprobe ath5k


All done. My variable ping times and random disconnections seem to have been mitigated. Thanks wireless guys!


Remove Dead Tags

Published on Monday, September 21, 2009

I've noticed my django-tagging install has been giving a lot of empty entries when doing a lookup on a tag. Tonight I finally got around to looking at what was causing this. This is surely not the best way to do this, but at 12:00am on a weekday, well, I shouldn't be doing it in the first place... I first wanted to see what type of content was generating the error:

for item in TaggedItem.objects.all():
try:
print item.object
except:
print item.content_type_id


Now that I could see what was causing it (I had removed an app that used django-tagging, but it left the tags with empty pointers). Removing the empty tags was easy enough:

for item in TaggedItem.objects.all():
try:
print item.object
except:
item.delete()


No more hanging TaggedItems.