June 27th, 2007

I bought a Sharp Zaurus and put OpenBSD on it with the intention of making a lap timer for my car. I tried to use this timer on my Treo in my R32, but it's so buggy and would crash the phone all the time, and trying to reboot a phone while racing around a track is not something I'd recommend.

There are of course some commercial timers but they are expensive and usually require a laptop running windows to be able to see the gps-acquired data. What's the fun in that?

So I started writing my own application, called Lapper. I made a sketch of the interface and started writing the code in Ruby using ActiveRecord with a SQLite backend for storing data. For the GUI I chose GTK+2, which has turned out to be rather slow (but quite pretty).

class Session < ActiveRecord::Base
  belongs_to :driver
  belongs_to :car
  belongs_to :track
  has_many :laps

  ...

The Zaurus is well equipped for such an application (sans CPU speed). The main feature being its touchscreen, since I need to operate the interface quickly while on the track and will only have my hand available. Since the screen rotates around and flips back over to cover the keyboard, its form factor remains small and has no other things to accidentally get pushed or broken.

I made a settings window in the GUI to adjust the Zaurus' screen brightness by hooking up a scroll bar widget to wsconsctl display.brightness. Clicking the app's power button calls apm -z.

I'm hoping that the tiny hard drive in the Zaurus doesn't get affected by the shock and vibration inside the car. If it does, I guess I can switch to a normal CompactFlash memory card for the hard drive.

Since it is equipped with external CompactFlash and SDIO slots, I bought a CompactFlash GPS receiver that works with OpenBSD and talk to it through gpsd. While timing, lapper receives data points from gpsd and stores them in memory. when a lap has passed (by manually pushing the button or crossing the track's defined GPS start/stop coordinates), it flushes the lap and all of the data point records to the SQLite database. This should work adequately for me since laps on the tracks I drive on will be in the range of 1:30 to 3:00 and data points are currently collected every 200ms.

Unfortunately GTK+2 is pretty big and slow, so the user interface is a bit lethargic while running on the little Zaurus. Even after using some tricks like drawing all of the windows at startup but hiding them until buttons are clicked, it isn't fast enough for my liking. I may just do something cheap like display a static bitmap for the interface and write some low level X stuff to respond to clicks in certain X/Y coordinates corresponding to where the buttons are drawn. I'll pass it off as "theme/skin support" and have the bitmap changeable.

I still need to write the functionality to view recorded laps and compare the lines and speeds between each one (example) as well as some kind of PNG/HTML export (though I did write a nice little to_gpx method for the Lap class to spit out the lap in gpx format).

I also need to make some sort of mount to secure it in the Exige without tearing up the dash. But at least I'll be able to say my racecar is running openbsd when this is all done.


My OQO Model 02 finally arrived as well. I ordered it in January and it finally arrived this month, 153 days later. i didn't even want it anymore and was getting tired of hearing OQO push the shipping date back, but i figured I might as well make OpenBSD work on it before I turn around and sell it.

It now has a Via processor, in contrast to the Transmeta processor in the model 01/01+. Audio is attached as an azalia(4) device but it does not work. The integrated Atheros AR5413 wireless attaches as an ath(4) device but also does not work. Integrated Ethernet is an rl(4) and works fine. Bluetooth works after enabling ubt in GENERIC. X11 works in 800x480 with a simple xorg.conf to manually specify the modeline, just like the OQO Model 01 (which worked somehow a long time ago, then broke, and now needs VesaBIOS to work).

I bought mine with the integrated Sprint EV-DO card, which I've made work under -current as a umsm(4) device. Though I now realize that it needs to be activated under Windows first before it can ever connect in OpenBSD.

But alas, I no longer use Sprint and switched back again to AT&T/Cingular because I was tired of my Treo 700p crashing all the time. It stopped syncing with my Mac the other week and I got fed up enough to go buy the new Blackberry Curve 8300. It is much smaller, thinner, lighter, and stable than my Treo. The change in operating system has taken some getting used to but I'm comfortable with it. I have IMAP, Jabber, and SSH on it, so that's all I need anyway.

Questions or comments?
Please feel free to contact me.