Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Thinkpad HDAPS + Panel Applet with recent kernels
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
GrayFox
Apprentice
Apprentice


Joined: 24 Jan 2004
Posts: 183
Location: Germany

PostPosted: Wed Jul 02, 2008 9:33 pm    Post subject: [HOWTO] Thinkpad HDAPS + Panel Applet with recent kernels Reply with quote

Some time ago I wanted to make HDAPS work on my ThinkPad T61. I had to do quite some patching and source editing to get things to work becuase most things were outdated (like the hdaps ebuild) or not fitting my needs (powersaving). So I thought I write up a little tutorial here for those interested.
For those who don't know: HDAPS is the hard drive active protection system for thinkpads. It parks the head of harddrives to prevent hdd damage when you drop or shake it.
You can also play neverball with it though since you can use the sensor as a joystick :).

1. The Kernel

Kernel >=2.6.37 (You problably want to follow this section!)
Get the kernel patch by Elias and apply it to your kernel.
If you don't know how to do it use my ebuild (it's just gentoo-sources+hdaps patch).
Simply copy the patch into the files dir and run
Code:
ebuild jenova-sources-2.6.xx.ebuild digest

(The usual local overlay thingy I still had no time to create my own remote overlay)

Kernel <2.6.27 and OUTDATED!
You need two kernel patches so that the disk head can be parked. The patches I found both didn't apply to current kernels so I had to modify them a bit.
The first one is the HDAPS blk_freeze patch the hdaps ebuild in portage also tries to apply (to older kernels only though).
The second one is also necessary or else you will probably experience freezes.
Here it's said that you no longer need the second when using a kernel >=2.6.26. But it still applies so I guess I'll stick with it in mine for now. Omit it on you own risk.
You can either apply them yourself or use the kernel in my ebuild package.
The kernel I packed is a 2.6.26-rc8 (most recent kernel at the time of this writing) + fbcondecor + hdaps_blk_freeze + ata_protect.
So it's not considered to be entirely stable but I have not experienced any lockups and I'm using this setup for a few months now.

Note: Make sure you do NOT enable CONFIG_SENSORS_HDAPS in your kernel before you recompile it! (This applies to both kernels)

2. The Kernel module
You need to install tp_smapi
Code:
emerge tp_smapi


3. The HDAPS daemon
The hdapsd in portage is not the newest. My overlay installs a recent hdapsd that does not send 200 ticks/second while running (I guess you want that too since all laptop users have tickless kernels?). This hdapsd is also not yet found in Gentoo's bugzilla.
Oh and a udev rule is also necessary:
Code:
# echo 'KERNEL=="event[0-9]*", ATTRS{phys}=="hdaps/input1",
ATTRS{modalias}=="input:b0019v1014p5054e4801-*",
SYMLINK+="input/hdaps/accelerometer-event"' >
/etc/udev/rules.d/51-hdaps.rules

After the installation is completed you can start it it. It should start up fine:
Code:
# modprobe tp_smapi
# modprobe hdaps
# /etc/init.d/hdapsd start


Note: The hdaps daemon works for all (patched) kernels
Note: I edited the initscript so it no longer checks for a validly patched kernel (it thinks a 2.6.27+patch is not properly patched).

Now your hdaps should be working! To test it tilt your laptop and check dmesg:
Quote:
scsi_protect_queue(): head parked..
scsi_unprotect_queue(): No pending I/O, re-enabling power management..

That is what you should see.
Note: With kernels >=2.6.27 those messages are no longer present instead you can check if your head is parked by issuing:
Code:
cat sys/block/sda/device/unload_heads # This returns != 0 if head is parked

To manually parking the disk head type:
Code:
echo 5000 > /sys/block/sda/device/unload_heads # This parks the head for 5 seconds


4. Optional: The GNOME panel applet
I also modified the code of the panel applet because it was sending wakeups like mad. Now it's still noticeable that the head was parked AND there are not 500+ wakeups per second.
Follow the instructions in the INSTALL file to install my version of the applet.
It also includes a set of nicer images.

Note: With kernels >=2.6.27 this applet no longer works. I use my own ruby script for that now. It depends on ruby and ruby-dbus.

I know this requires a lot of manual installing and I will try to come up with a proper overlay some time (I hope). Also this post is still quite uninformative so I will work on that, too.
Maybe when it takes some shape somebody can upload this to gentoo-wiki?
If anybody knows updated versions of mentioned patches or programs please tell me. I spent days looking up all those files and making them work together like they should.
Also I'll try to keep this up to date and synchronized with my working environment until all those patches are in the mainstream kernel or easily obtainable via portage.

Cheers

My sources:
https://bugs.gentoo.org/show_bug.cgi?id=166166
http://www.thinkwiki.org/wiki/HDAPS#Disk_head_parking
http://www.thinkwiki.org/wiki/How_to_protect_the_harddisk_through_APS#Adding_kernel_support
http://www.thinkwiki.org/wiki/Installing_Ubuntu_7.04_on_a_ThinkPad_T43#Disk_Protection
http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2008-February/042226.html
http://article.gmane.org/gmane.linux.drivers.hdaps.devel/1245
http://article.gmane.org/gmane.linux.drivers.hdaps.devel/1040
http://news.gmane.org/gmane.linux.drivers.hdaps.devel in general

13.10.2008: EDIT #1
Updated the howto to represent the current status of hdaps development. The kernel patches are as it seems making their way into the mainline 2.6.28 kernel. So there are (almost) completely rewritten patches availiable now for kernel >=2.6.27 and a new backwards compatible hdaps daemon.
_________________
Random Stuff
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum