One of the cool features in a Thinkpad is HDAPS or IBM Active Protection System as it’s called.

The system consist of two parts. The driver that enables reading the acceleration data and some sort of userspace software that does the actual parking of the harddrive heads, usually hdapsd.

The hdaps driver is part of the kernel but the driver maintainers actually recommend using the tp-smapi driver instead. So that’s what we’ll do.

Start by making sure you have the necessary tools installed

$ sudo apt-get install build-essential module-assistant

Luckily it’s in the package repository (universe)

$ sudo m-a a-i tp-smapi

this will fetch and install the tp-smapi-source package, unpack the source and then compile and install the kernel module.

Try loading it:

$ sudo modprobe tp_smapi
$ sudo modprobe hdaps

The kernel log should show something like this:

[ 1546.780684] thinkpad_ec: thinkpad_ec 0.37 loaded.
[ 1546.784125] tp_smapi 0.37 loading...
[ 1546.784406] tp_smapi successfully loaded (smapi_port=0xb2).
[ 1571.445942] hdaps: LENOVO ThinkPad T61 detected, setting orientation 1
[ 1571.446111] hdaps: initial mode latch is 0x05
[ 1571.446265] hdaps: setting ec_rate=250, filter_order=2
[ 1571.446493] hdaps: device successfully initialized.
[ 1571.446607] input: ThinkPad HDAPS joystick emulation as /devices/virtual/input/input13
[ 1571.469284] input: ThinkPad HDAPS accelerometer data as /devices/virtual/input/input14
[ 1571.505138] hdaps: driver successfully loaded.

For some reason some configuration for udev is missing. Fix this by running

echo 'KERNEL=="event[0-9]*", ATTRS{phys}=="hdaps/input1",ATTRS{modalias}=="input:b0019v1014p5054e4801-*",SYMLINK+="input/hdaps/accelerometer-event"' | sudo tee /etc/udev/rules.d/51-hdaps.rules

Now for the userspace stuff. First let us test if APS is actually working.

$ sudo apt-get install hdaps-utils

After installation you can use

hdaps-pivot

or

hdaps-gl

to verify that the sensors are working

The

hdapsd

package in Jaunty does not support the new smapi interface. I have created a package based on the latest revision of hdapsd. It also fixes a problem with the init-script.

With the stock init-script you get an error like this:

* Not starting hdapsd: /sys/block/hda/queue/protect does not exist, please read /usr/share/doc/hdapsd/README.Debian

This happens because the init-script actually checks for the APS interface in /sys (this is no longer supported).

Removing the call to

do_checkprotect

during startup fixes this.

hdapsd in Jaunty is old. There is a PPA with newer versions.

Add the PPA to your repository list

$ cat | sudo tee /etc/apt/sources.list.d/hdapsd.list << EOF
> deb http://ppa.launchpad.net/jonasped/ppa/ubuntu jaunty main
> deb-src http://ppa.launchpad.net/jonasped/ppa/ubuntu jaunty main
> EOF

And add the PPA key

$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 45EA2DEACE74152B61554DE4036A90F2BEFC6EB4

and then update the package list and install the package

$ sudo apt-get update
$ sudo apt-get install hdapsd

Remember to edit

/etc/default/hdapsd

to match your system.