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
synaptic
, find
the
tp-smapi-source 0.40-1
package
and install it. This will leave a source
archive in
/usr/src
. You will also
require the
module-assistant
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:
cd /usr/src
sudo module-assistant build tp-smapi
sudo module-assistant install tp-smapi
That installed three modules into the current
system module
tree:
thinkpad_ec
,
tp_smapi
,
and
hdaps
. 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:
/sbin/depmod
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
/usr/src/rebuild-tp-smapi
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
/etc/modules
:
sudo ed /etc/modules
$a
thinkpad_ec
tp_smapi
hdaps
.
wq
so the system will load the modules at boot
time, and install the following parameters
into
/etc/modprobe.d/tp_smapi.conf
:
sudo ed /etc/modprobe.d/tp_smapi.conf
a
options thinkpad_ec force_io=1
options hdaps invert=5
.
wq
The
force_io
option instructs
the
thinkpad_ec
module to ignore
that the memory it wants to use is marked as
reserved memory. Without the option it will
complain and abort. The
invert
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
synaptic
and install
the
hdaps-uitls
module. Then you
can use
hdaps-gl
to view the
workings of your accelerometer. The raw
interfaces are
in
/sys/devices/platform/smapi/
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
tp-smapi-sources
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.