Recently in OpenMooCow Category

July 20, 2009

OpenMooCow Using ALSA Directly

I've now got bored enough of SDL problems (as described here) to start work on a version of OpenMooCow which uses ALSA directly.  Development can be found in the "alsa" branch, here.

It basically works, but still uses SDL only for loading the WAV file and converting the sample rate of the sound.  After removing the SDL dependency altogether, it'll be released as version 0.5.

April 14, 2009

SDL and Accelerometer Issues with OpenMooCow

I've heard quite a large number of complaints that OpenMooCow doesn't work with various distributions on Openmoko. Most of these problems aren't directly my fault, but here's a guide to solving them.

If your cow doesn't moo openly, then you should first determine whether you're having an audio problem, an accelerometer problem, or both. Run OpenMooCow from a terminal, via SSH, like this:

$ DISPLAY=:0 openmoocow

You should see some text output ("Moo!") which tells you that a moo has been triggered when you invert your phone, even if you get no sound. If that happens, then your accelerometers are working.

To test the audio without using the accelerometers, simply touch the cow's picture on the screen. If you get a sound, then the audio parts are working properly.

Most commonly, it seems that the SDL packages distributed in SHR (and probably others) try to use the old OSS system for their audio. You therefore need to tell the kernel to enable ALSA's OSS emulation to get audio. You can do this with the following command:

$ modprobe snd-pcm-oss

To make this permanent, do something like this:

$ echo "snd-pcm-oss" > /etc/modutils/snd-pcm-oss
$ update-modules

Additionally, the SDL package distributed by Debian for the FreeRunner has a much larger problem, which there currently isn't any known workaround for. It appears that the sound scheduler callback in OpenMooCow simply doesn't get called by SDL, for no apparent reason.

If you're using version 0.3 (or earlier) of OpenMooCow with a kernel from later than May 2009, the accelerometer readings will be broken due to a change in the way accelerometer data is reported. This is fixed in the latest Git version, which will shortly be tagged and released as version 0.4. SHR-unstable is currently tracking Git HEAD for OpenMooCow, so users of that particular distribution should already have been updated.

Finally, versions up to and including 0.3 have a bug which causes a crash if the accelerometer threshold value couldn't be updated. OpenMooCow sets this to zero to make sure it gets data about small movements of the phone, and restores it afterwards. The sysfs paths changed (again) for recent kernels (see here), and the change triggers this bug. This problem has also been fixed in the recent Git version, and the fix will be included in version 0.4. There are actually two fixes: one to make it aware of the new sysfs paths, and one to fix the crash if the sysfs paths aren't what it expected.

Phew. Who would've thought that such a silly little program could cause so many problems.

Update: OpenMooCow 0.4 now released. See the OpenMooCow page for details.

January 26, 2009

Git Server

You might be interested in my public Git server. There you will find source code on all my exciting software projects, including OpenMooCow (the scarily popular moobox simulator), my Openmoko bits which constitute the beginnings of hardware-accelerated 3D rendering with Glamo, and Thrust3D, my silly 3D version of Jet Set Willy in a post-apocalyptic scenario.