New Atheros Module and Ubuntu

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

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.

Most Frequently Used French Words

Status: ✅

I’m currently studying French, and if you’ve read any of this site, you’ll notice I’m a bit of a techie. Often several of my interests collide, which is what happened today. I was searching for the “most frequent french words,” and while I found some lists, nothing was exactly what I wanted.
My desire was to have a PDF of the top few thousand most used French words. With the English translation next to it. In order. I’ve found some great resources, which I’ll list now

I’ve also found 100s of sites with 50 words or so - not exactly what I wanted. This spawned a question for me: if I were to search a popular French newspaper website, what words would be the most frequent? I would want to learn those first. A few hours later, and I’ve compiled that list. I’ll write the details of how I did it at the end, but just know I collected over 16,000 unique words, and “read” over 80,000 words from a variety of articles. Below is a PDF of the most popular words, ranked in order, with (maybe incorrect) English translations.

The 625 Most Unofficially Frequent French Words

More to come…! I’m going to continue building the database to make sure the ranking is correct, and will make some pretty graphs when I have time. I will also likely modify things to include what type of word it is, and an example in a sentence.

Please feel free to use this list as you see fit in accordance with CC by 4.0

Testing SMS Gateways

For one of my projects I’m testing an SMS gateway, and decided it would be fun to build a useful alarm clock out of it. For those of you who know Python, you may find this funny. /dev/ttyUSB0 is my Arduino with a temperature sensor.

import serial
import urllib2
 
def check_temp():
    ser = serial.Serial('/dev/ttyUSB0', 9600)
    t = ser.readline().strip()
    return float(t)
 
    t = check_temp()
    if int(t) < 8:
        message = "It+is+now+%f+degrees;+chuck+a+sicky." % t
        f = urllib2.urlopen('http://api.clickatell.com/http/sendmsg?user=johnd&password=p@55w0rd&api_id=2132867&from=61433735555&to=61433735555&text=%s' % message)

```bash

And in crontab:

```bash
45 6 * * * python /opt/scripts/temp_alarm.py

Arduino 101

Tonight, I’m proud to say, I’ve returned to childhood. Let me explain.

OK, fun over, back to work.

For the last year I’ve been wanting to purchase an Arduino, for no other reason than to play with. Like a kid. My Arduino arrived two days ago. This is a story of problems, but not the pull-your-hair-out type, more the… like when you run out of gas in the middle of Sydney. Going to your Christmas dinner. In your friend’s car. Long story.

As a kid I never really learned about electronics. I took apart anything broken my parents set downstairs (and put back together the microwave I dismantled that my parent were going to give to my sister as a gift). But no electronics. I had a computer of some sort from when I was a wee kid, but not a single electronics kit, or not one I can remember.

I soon realised I forgot to order a few resistors needed for the various sensors I purchased. This morning before work I stopped by the local electronics store, and like a kid in a candy shop, ordered $1.60 worth of resistors and LEDs.

Just after coming home and eating insanely good Indian with YS, I set out to get an LED blinking. Without too many troubles, success! I graduated myself to the next grade and pulled out the temperature sensor. I looked at the ‘special’ wires I bought to connect to the sensor and the breadboard, and I soon realised I actually purchased the M->F wires instead of the assorted pack. I started looking around for cables I could cut.

Spare USB cable, no. Telephone cable, maybe. I realised I could just slice up one of the cables and see if it worked. The cables were braided instead of solid coper, which sort of made my hopes sink, but it was too late now.

I soon wired everything together as the various forum posts suggest, plugged it in to my laptop, started the Arduino software, and loaded the Dallas Temperature Library, and - “Invalid CRC”. I pulled the wires off, stripped a little more cabling off, plugged it back in, and tried again. It worked! I don’t really know if the temperature is correct or not - we don’t have any other way to measure it - but at this point, until I put in some more robust wires, I don’t really even care.

Overall, I’m happy. I’ve created two simple physical computing missions, and wrote two blog entries, in well under two hours. This has been quite a relaxing break from the other duties in life. I plan to make the little system ‘proper’ (more robust), and link it to my mini server. I’ll then create a simple chart (via Google’s API) to display on this website.
OK, fun over, back to work.

Simple Arduino + LED Tutorial

For this you’ll need: an Arduino, an LED, a USB cable, and the Arduino software.

  1. Get the LED, and plug it in to your Arduino. Plug in the long end to pin 13, plug the short end to the GND.
  2. Plug in the Arduino into your laptop. Go to Tools->Serial Port. Choose the USB port that appears.
  3. Take the code from the BlinkingLED tutorial and paste it in to the arduino like so:

  1. Hit File->Upload to I/O Board.
  2. Hit (physically) the little reset button. Voila! a blinking LED!

GPS Gem Find - TangoGPS

I’ve been looking for a simple, no-hassles GPS display program for Linux, and I believe I finally found one: TangoGPS. My requirements were quite simple; I needed something that would talk to gpsd, and display a dot on OpenStreetMaps. I’ve been able to do this in other programs (even in 3d in WorldWind), but I wanted something to download the maps for me, and GTK+ would be a plus.

TangoGPS was easy to install (apt-get install tangogps), and on my test ‘drive’ home tonight on the train, worked a treat. See related screenshots.

ISO Code Error

I’ve received this error a few times when working with pytz:

Error reading file '/usr/share/xml/iso-codes/iso_3166.xml'

In short, install the ‘iso-codes’ package in Ubuntu/Debian. I’m sure this is covered in the manual that I didn’t read, but I’m sure others didn’t read it too.

apt-get install iso-codes

Installing Debian 5.0 on Vortex86DX

After writing about compiling a new kernel for the Vortex86DX, I’ve had quite a few people email me asking how I installed Debian in the first place. The installation is actually quite straightforward, but it involved several quirky techniques. After doing another install I decided to keep track of the process of installing Debian 5.0 on my eBox-3300.

The following guide assumes a few things. First, you are currently using Linux and a debian variety (although instructions could be altered if using Windows). Second, your USB shows up as /dev/sdb. Third, your eBox-3300 has the HDD set in Native mode. Forth, you are patient.

  1. Download the custom vmlinuz and initrd.gz files from my site. Also, download the custom deb files we’ll use near the end of installation:
http://cdn.kelvinism.com/ebox/vmlinuz
http://cdn.kelvinism.com/ebox/initrd.gz
http://cdn.kelvinism.com/ebox/linux-headers-2.6.29.3-vortex86dx.deb
http://cdn.kelvinism.com/ebox/linux-image-2.6.29.3-vortex86dx.deb

EDIT 16-03-2025: I’ve since removed these files.

  1. Download an i386 netinst iso:
http://www.debian.org/CD/netinst/
  1. Make sure the USB has an MBR installed:
apt-get install syslinux mtools mbr
install-mbr /dev/sdb
  1. Format the device as FAT32 with whatever tool you like.
  2. Run syslinux on it:
syslinux /dev/sdb1
  1. Mount the USB (or pull it out and plug it in again so it shows up on your desktop), and copy the downloaded vmlinuz, initrd, netinst.iso and deb files onto the USB. There should be a file called ldlinux.sys already; create a file called syslinux.cfg and put the following in it:
default vmlinuz
append initrd=initrd.gz root=/dev/rd/0 devfs=mount,dall rw DEBCONF_PRIORITY=medium
  1. Unmount the USB, and put it in your eBox-3300. When the system boots up initially, hit F11. Select your USB device. Depending how you created the MBR it might come up as saying “MBR FA:”. Press “A”. When 1234F comes up, press “1”. Press enter at the SYSLINUX “boot:” screen.
  2. Proceed as normal through the menu. It will search for an ISO image, and should detect the netinst image you inserted earlier. When you get to the “Load installer components” section, it will complain about no kernel modules found. Select YES. On the next screen you shouldn’t need to load any components, so hit continue. Proceed as normal.
  3. If you are ever asked about starting PC card services, hit NO. Proceed as normal.
  4. Eventually you will hit a screen that says LVM is not available, hit CONTINUE. Proceed as normal.
  5. Near the end it will toss up a list of available kernels. Select either, it shouldn’t matter. When you are allowed to select drivers to include in the initrd, select TARGETED. Proceed as normal.
  6. You might get to a point where it says Install GRUB boot loader on a hard disk. This will fail. That’s ok, just skip it and select “continue without boot loader”.
  7. You will end up on the “Finish the installation” menu. DO NOT finish! We now need to swap out the current kernel with one that works. Scroll down and select “Execute a shell”. Press CONTINUE. Try these steps when the shell prompt appears:
cd hd-media
cp *.deb /target/usr/src/
cp vmlinuz /target/boot/vmlinuz-2.6.26-2.486
cp initrd.gz /target/boot/
cd /target/boot
gunzip initrd.gz
mv initrd initrd.img-2.6.26-2-486
reboot

Your system will now reboot, and it should actually boot correctly. However, you’re using a kernel that doesn’t have any headers or modules, which means you can’t activate anything. Once the box boots up, login and install the included custom kernels:

cd /usr/src
dpkg -i linux-image-2.6.29.3-vortex86dx.deb
dpkg -i linux-headers-2.6.29.3-vortex86dx.deb
reboot

Once the system comes back up, you should be running a spiffy 2.6.29 kernel, with the ability to add modules.

You may want to follow the tuning section from the MicroClient page on Google Groups. I also modified my fstab file to help reduce wear on the CF card:

tmpfs /var/run tmpfs defaults,noatime 0 0
tmpfs /var/lock tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0

Contribution 1: Francois Fleuret emailed through a kind reminder that the qemu-onto-SD card method is a viable option. So, if you want to go the SD route, and have an SD reader, this might be what you’re after!

Basically, install Debian on a SD card with qemu (start qemu with the
install disk iso as cdrom and the SD card as hda), while you are still
in qemu, download and install the kernel deb file

ftp://ftp.icop.com.tw/upload/Shawn/linux-image-2.6.27.9-vortex86dx_2.6.27.9-vortex86dx_i386.deb

then quit qemu, put the SD card in the box and reboot. You are done!

EDIT 16-03-2025: I have since removed these files.

If you want the source file for the above kernels, you can get it from here: 2.6.29-3 source. I recently recompiled the kernel with some extra modules enabled (e.g. ecryptfs), so if you would like to try a newer kernel, you can download my updated kernels too:

http://cdn.kelvinism.com/ebox/linux-headers-2.6.30.4-vortex86dx.deb
http://cdn.kelvinism.com/ebox/linux-image-2.6.30.4-vortex86dx_2.6.30.4.deb

EDIT 16-03-2025: I have since removed these files.

Contribution 2: Trent L has also recompiled a 2.6.28 kernel with wireless extensions built into it, which is what was needed for his wireless card. He has kindly allowed me to distribute them; you can find them here:

http://cdn.kelvinism.com/ebox/linux-source-2.6.28.10_vortex86dx.deb
http://cdn.kelvinism.com/ebox/linux-image-2.6.28.10_vortex86dx.deb
http://cdn.kelvinism.com/ebox/linux-headers-2.6.28.10_vortex86dx.deb
http://cdn.kelvinism.com/ebox/2.6.28.config

EDIT 16-03-2025: I have since removed these files.

Contribution 3: If you have the ebox-3310, you can still read through this, but you may also want to see a suggested installation method and kernels from Stefan.

Contribution 4: Alexandru T. sent through some instructions directly received from ICOP. I’ve added another page with the details. Thanks Alex!

Contribution 5:: Rainbow sent through the solution if your kernel panics with:

it report "kernel bug at fs/buffer.c 1864" and system go mad, even
> "halt" "reboot" take no effect.

Rainbow reported that:

this issue cause by an error Vcore, 0.90v refered by datasheet, and it should be above 0.97.

Contribution 6:: Bob’s also sent through his config file.

Contribution 7: Bob A. has sent through some resources about a special ISO specific for the ebox. It has been added to another page.

Update: I’ve needed to recompile a new Lenny vortex86dx-enabled kernel for 2.6.31.5: image, headers, source and config.

Operation Cold House

Status: ✅

My house is cold. I want to start playing with simple electronics before starting Operation Field, so have created Operation Cold House.

This is just simply sticking a temperature sensor onto an Arduino, linking that up to my little home “server”, and uploading that to my website. I’ll display some nifty graphs, too, and link it to Pachube. Stay tuned.

Update: Complete! The proof is in the pudding. I now have a personal website from home (sorry, not public) that displays the daily and weekly temperature at home. The process is basically like this: my little Arduino gathers the temperature, and is polled every minute with a python script via cron. This script then sticks the time and temperature into MySQL. It also exports the temperature to Pachube. Every 30m I have a script that queries MySQL and uses Google’s Chart’s API to graph the temperature. Looks great, I’ll post a graph soon.