Now in linux-acpi mainline

The code below should now be considered old, as the driver has been picked up by linux-acpi's project tree, thanks to Matthew Garret for integrating it into the newest tree and rfkill subsystem.

OQO accelerometer driver

This is a work-in-progress page for a driver that uses the new 2.6.25 acpi-wmi code to read the accelerator registers and peek/poke more important bits on an OQO -- currently just Model 2 OQOs as that is what I own. (Thanks Bro!) It handles the WWAN enable switch which disables the power to the GSM USB module. It also allows adjusting or turning off the backlight.

To test it you'll need:

The accelerometer (and the light sensor) will appear as a normal joystick, and will do basically nothing unless you open that file. Either way, it should not interfere with HD protection. Try jstest on the /dev/input/jsN file that appears.

It provides a backlight interface at:

/sys/devices/platform/oqo-wmi/backlight\:oqo-bl

The wwan device enable switch can be found at:

/sys/devices/platform/oqo-wmi/wwan_enable

There are some limitations. Although the inbuilt coprocessor undoubtably samples the accelerometer at a rapid rate, it only "publishes" those values occasionally. If I read the info OQO has released right, once every 8ms -- which would not be too bad for something like gaming use.

However you can't get even that many readings reliably because the accelerometer is on a shared bus with lots of other important stuff, all of which is driven by the kernel through ACPI routines. While the bus should be able to deliver readings at least at this rate, it seems to work awfully slow. Also there's overhead in trying not to get half of the last reading mixed in with the other half of the next one. As packaged it uses a conservative 4 readings per second to try to be as error free as possible.

Oh yeah:

mkdir oqo-wmi
cd oqo-wmi
wget 'http://abrij.org/~bri/hw/oqo-wmi.c' 
echo obj-m += oqo-wmi.o > Makefile
make -C /usr/src/linux-source-2.6.25-rc8/ SUBDIRS=$PWD modules