The new scoop is to use tp-smapi-dkms
which will reinstall the accelerometer support each time you install a new kernel. It's working fine with the standard Karmic kernel but not with the real time kernel. And there appears to be accelerometer support in F-spot, too, at least I assume that's how it figures out to rotate pictures when I rotate the laptop.
Note added 2009-11-21 16:03 -0600.
Originally published 2009-03-19 13:03:37 -0600
Getting the accelerometer to work on my Lenovo Thinkpad X200 Tablet was complicated enough that I've forgotten how to do it more than once. Here's the scoop.
The first step is to go into
, find the
package and install it. This will leave a source archive in
. You will also require the
package, so check to make sure it's installed, too, before you leave synaptic.
The second step is to build and install the package. You'll need to do this for each new version of the system that you install, and they're coming thick and fast these days. The commands for this are:
sudo module-assistant build tp-smapi
sudo module-assistant install tp-smapi
That installed three modules into the current system module tree:
. The new improved modules are installed in different locations than the incorrect modules that shipped with the kernel, so we need to remove the old ones:
sudo rm /lib/modules/`uname -r`/kernel/ubuntu/misc/thinkpad_ec.ko
sudo rm /lib/modules/`uname -r`/kernel/ubuntu/misc/tp_smapi.ko
sudo rm /lib/modules/`uname -r`/kernel/drivers/hwmon/hdaps.ko
Finally, we rebuild the system module catalog so it will find the new modules:
All of the above will need to be redone each time you install a new kernel package, so you might put them all into a script in
so you can find it.
There are two more steps that you'll need to do only the first time. Append the following lines to
sudo ed /etc/modules
so the system will load the modules at boot time, and install the following parameters into
sudo ed /etc/modprobe.d/tp_smapi.conf
options thinkpad_ec force_io=1
options hdaps invert=5
option instructs the
module to ignore that the memory it wants to use is marked as reserved memory. Without the option it will complain and abort. The
option sets the accelerometer axes correctly for normal laptop configuration, but they'll be wrong if you flip the screen around to tablet configuration, and you'll need different values for portrait and landscape. But that's another article.
At this point you should be able to load the modules with:
sudo /sbin/modprobe hdaps
and try it out. Oh, right, go back to
and install the
module. Then you can use
to view the workings of your accelerometer. The raw interfaces are in
and you can find out more about this at the ThinkWiki HDAPS
page and others at that site.
Note that this method of installation is possible because the
package is available for the Ubuntu Jaunty Jackelope kernels, that's why this method is simpler than the ones described at tp_smapi
in the ThinkWiki. One can hope that the improved sources will simply be included in the kernel itself, consigning this page to the dustbin of history.