<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tava</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tava"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Tava"/>
	<updated>2026-04-30T00:29:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21381</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21381"/>
		<updated>2006-04-05T16:28:12Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Building an applet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060326.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -&amp;gt; hardware monitoring -&amp;gt; ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild, use same ebuild date as the kernel-patch&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Makes portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles (if no internet connection is available): &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
&lt;br /&gt;
0.) Make sure you have installed hdaps [and loaded] and ?opengl?&lt;br /&gt;
&lt;br /&gt;
1.) Download hdaps-gl-0.0.5 from the www&lt;br /&gt;
&lt;br /&gt;
2.) Extract files to /opt/hdaps-gl&lt;br /&gt;
&lt;br /&gt;
3.) {{cmdroot|make}}&lt;br /&gt;
&lt;br /&gt;
4.) Start applett {{cmdroot|./hdaps-gl}}&lt;br /&gt;
&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21380</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21380"/>
		<updated>2006-04-05T16:20:47Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Installing hdapsd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060326.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -&amp;gt; hardware monitoring -&amp;gt; ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild, use same ebuild date as the kernel-patch&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Makes portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles (if no internet connection is available): &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21379</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21379"/>
		<updated>2006-04-05T16:19:52Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Patching the kernel and enabling the drivers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060326.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -&amp;gt; hardware monitoring -&amp;gt; ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Makes portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles (if no internet connection is available): &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21378</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21378"/>
		<updated>2006-04-05T16:16:44Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Installing hdapsd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -&amp;gt; hardware monitoring -&amp;gt; ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Makes portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles (if no internet connection is available): &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21377</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21377"/>
		<updated>2006-04-05T16:15:46Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Installing hdapsd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -&amp;gt; hardware monitoring -&amp;gt; ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Makes portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles: &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Tp_smapi&amp;diff=21376</id>
		<title>Tp smapi</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Tp_smapi&amp;diff=21376"/>
		<updated>2006-04-05T16:14:03Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Installation in Gentoo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |The &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt; kernel module exposes some features of the ThinkPad's [[SMAPI support for Linux|SMAPI]] functionality via a &amp;lt;tt&amp;gt;sysfs&amp;lt;/tt&amp;gt; interface. Currently, the implemented functionality is control of battery charging, extended battery status and control of CD/DVD speed (disabled by default).&lt;br /&gt;
&lt;br /&gt;
For old ThinkPad models, see also [[tpctl]].&lt;br /&gt;
&lt;br /&gt;
{{WARN|This driver uses undocumented features and direct hardware access. It thus cannot be guaranteed to work, and may cause arbitrary damage (though so far none was reported).}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
*Battery charge/discharge control&lt;br /&gt;
*Battery status information&lt;br /&gt;
*Optical drive speed control (disabled by default)&lt;br /&gt;
&lt;br /&gt;
===Project Homepage / Availability===&lt;br /&gt;
* Project page: http://tpctl.sourceforge.net/&lt;br /&gt;
* You need to download only the [http://sourceforge.net/project/showfiles.php?group_id=1212&amp;amp;package_id=171579 tp_smapi kernel module].&lt;br /&gt;
&lt;br /&gt;
===Installation===&lt;br /&gt;
====Installation from source====&lt;br /&gt;
You will need the kernel headers and makefiles corresponding to your current kernel version. On {{Fedora}}, this means {{cmdroot|yum install kernel-devel-$(uname -r)}} .&lt;br /&gt;
&lt;br /&gt;
For testing, you can simply compile and load the driver within the current&lt;br /&gt;
working directory:&lt;br /&gt;
:{{cmdroot|tar xzvf tp_smapi-0.18.tgz}}&lt;br /&gt;
:{{cmdroot|cd tp_smapi-0.18}}&lt;br /&gt;
:{{cmdroot|make load}}&lt;br /&gt;
&lt;br /&gt;
To compile and install into the kernel's module path:&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
&lt;br /&gt;
If you use the [[HDAPS]] driver, add &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; to also patch the &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt; for compatibility with &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt; (this requires a kernel source tree matching the current kernel):&lt;br /&gt;
:{{cmdroot|1=make load HDAPS=1}}&lt;br /&gt;
or, to compile and install into the kernel's module path:&lt;br /&gt;
:{{cmdroot|1=make install HDAPS=1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To prepare a stand-alone patch against the current kernel tree (including&lt;br /&gt;
a compatibility fixes to &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Kconfig&amp;lt;/tt&amp;gt; entries):&lt;br /&gt;
:{{cmdroot|make patch}}&lt;br /&gt;
&lt;br /&gt;
To delete all autogenerated files:&lt;br /&gt;
:{{cmdroot|make clean}}&lt;br /&gt;
&lt;br /&gt;
The original kernel tree is never modified by any these commands. &lt;br /&gt;
The {{path|/lib/modules}} directory is modified only by {{cmdroot|make install}}.&lt;br /&gt;
&lt;br /&gt;
====Installation in Gentoo====&lt;br /&gt;
The {{Gentoo}} portage system carries a [http://packages.gentoo.org/packages/?category=app-laptop;name=tp_smapi tp_smapi package], which follows the latest version pretty closely. On a Gentoo system, you can install and load as follows.&lt;br /&gt;
&lt;br /&gt;
To install:&lt;br /&gt;
:{{cmdroot|emerge tp_smapi}}&lt;br /&gt;
&lt;br /&gt;
To load:&lt;br /&gt;
:{{cmdroot|modprobe tp_smapi}}&lt;br /&gt;
&lt;br /&gt;
If you use the [[HDAPS]] driver, install using&lt;br /&gt;
:{{cmdroot|1=USE=&amp;quot;hdaps&amp;quot; emerge tp_smapi}}&lt;br /&gt;
and, before loading as above, run {{cmdroot|rmmod hdaps}} or reboot to unload the old (unpatched) &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt; kernel module.&lt;br /&gt;
&lt;br /&gt;
Info: &lt;br /&gt;
&lt;br /&gt;
1.) Use [[HDAPS]] driver as module in your kernel&lt;br /&gt;
&lt;br /&gt;
2.) add hdaps use flag in /etc/make.conf&lt;br /&gt;
&lt;br /&gt;
3.) {{cmdroot|emerge tp_smapi}} or install tp_smapi with hdaps support manual (see above)&lt;br /&gt;
&lt;br /&gt;
4.) {{cmdroot|echo &amp;quot;tp_smapi&amp;quot; &amp;gt;&amp;gt; /etc/modules.autoload/kernel2.6}}&lt;br /&gt;
&lt;br /&gt;
5.) {{cmdroot|echo &amp;quot;hdaps&amp;quot; &amp;gt;&amp;gt; /etc/modules.autoload/kernel2.6}}&lt;br /&gt;
&lt;br /&gt;
===Battery charge control features===&lt;br /&gt;
To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):&lt;br /&gt;
:{{cmdroot|echo 40 &amp;gt; /sys/devices/platform/smapi/BAT0/start_charge_thresh}}&lt;br /&gt;
:{{cmdroot|echo 70 &amp;gt; /sys/devices/platform/smapi/BAT0/stop_charge_thresh}}&lt;br /&gt;
:{{cmdroot|cat /sys/devices/platform/smapi/BAT0/*_charge_thresh}}&lt;br /&gt;
{{HINT|Battery charging thresholds can be used to keep Li-Ion ad Li-Polymer batteries partially charged, in order to [[Maintenance#Battery_treatment|increase their lifetime]].}}&lt;br /&gt;
To unconditionally inhibit charging for 17 minutes:&lt;br /&gt;
:{{cmdroot|echo 17 &amp;gt; /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}&lt;br /&gt;
{{HINT|Charge inhibiting can be used to reduce the power draw of the laptop, in order to use a an under-spec power supply that can't handle the combined power draw of running and charging. It can also be used to control which battery is charged when [[How to use UltraBay batteries|using an Ultrabay battery]].}}&lt;br /&gt;
&lt;br /&gt;
To cancel charge inhibiting:&lt;br /&gt;
:{{cmdroot|echo 0 &amp;gt; /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}&lt;br /&gt;
&lt;br /&gt;
To force battery discharging even if connected to AC, use one of these:&lt;br /&gt;
:{{cmdroot|echo 1 &amp;gt; /sys/devices/platform/smapi/BAT0/force_discharge}}&lt;br /&gt;
{{HINT|This can be used to choose which battery is discharged when [[How to use UltraBay batteries|using an UltraBay battery]].}}&lt;br /&gt;
&lt;br /&gt;
To cancel forced discharge:&lt;br /&gt;
:{{cmdroot|echo 0 &amp;gt; /sys/devices/platform/smapi/BAT0/force_discharge}}&lt;br /&gt;
&lt;br /&gt;
===Battery status features===&lt;br /&gt;
To view extended battery status such as charging state, voltage, current, capacity, cycle count and model information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/installed&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/state       # idle/charging/discharging&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/cycle_count &lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/current_now # instantaneous current&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/current_avg # last minute average&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/power_now   # instantaneous power&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/power_avg   # last minute average&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/last_full_capacity&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/remaining_capacity&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/design_capacity&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/voltage&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/design_voltage&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/manufacturer&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/model&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/serial&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/barcoding&lt;br /&gt;
# cat /sys/devices/platform/smapi/BAT0/chemistry&lt;br /&gt;
# cat /sys/devices/platform/smapi/ac_connected&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The raw status data is also available, including some fields not listed above (in case you can figure them out):&lt;br /&gt;
&lt;br /&gt;
:{{cmdroot|cat /sys/devices/platform/smapi/BAT0/dump}}&lt;br /&gt;
&lt;br /&gt;
In all of the above, replace &amp;lt;tt&amp;gt;BAT0&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;BAT1&amp;lt;/tt&amp;gt; to address the 2nd battery.&lt;br /&gt;
&lt;br /&gt;
Note that the battery status readout conflicts with the stock [[HDAPS|hdaps]] driver, so if you use &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt; you will need to load &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt; using {{cmdroot|1=make load HDAPS=1}} (see [[#Conflict_with_hdaps|Conflict with hdaps]] below).&lt;br /&gt;
&lt;br /&gt;
On [[ACPI]]-enabled systems, most of above information is also available through the files under {{path|/proc/acpi/battery}}. However, the ACPI interface does not include the instantaneous power and cycle count readouts, and does not work well when [[How to use UltraBay batteries|hotswapping UltraBay batteries]].&lt;br /&gt;
&lt;br /&gt;
===Optical drive control features===&lt;br /&gt;
&lt;br /&gt;
To control the speed of the optical drive:&lt;br /&gt;
:{{cmdroot|echo 0 &amp;gt; /sys/devices/platform/smapi/cd_speed # slow}}&lt;br /&gt;
:{{cmdroot|echo 1 &amp;gt; /sys/devices/platform/smapi/cd_speed # medium}}&lt;br /&gt;
:{{cmdroot|echo 2 &amp;gt; /sys/devices/platform/smapi/cd_speed # fast}}&lt;br /&gt;
:{{cmdroot|cat /sys/devices/platform/smapi/cd_speed}}&lt;br /&gt;
&lt;br /&gt;
=====Enabling this feature=====&lt;br /&gt;
Changing the drive speed when a disc is being accessed will hang your computer. This feature is thus '''disabled by default''', but can be enabled using by adding &amp;lt;tt&amp;gt;#define PROVIDE_CD_SPEED&amp;lt;/tt&amp;gt; at the top of &amp;lt;tt&amp;gt;tp_smapi.c&amp;lt;/tt&amp;gt;. The safe way to set the drive speed is using &amp;lt;tt&amp;gt;hdparm -E num&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;eject -x num&amp;lt;/tt&amp;gt; for CD-ROM, and &amp;lt;tt&amp;gt;speedcontrol -x num&amp;lt;/tt&amp;gt; (sourcecode [http://safari.iki.fi/speedcontrol.c here]) for DVD. For kernels older than 2.6.15, this may require the [[Problems_with_SATA_and_Linux#No_SMART_support libata pass-through|libata pass-through patch]].&lt;br /&gt;
&lt;br /&gt;
===Features not yet implemented===&lt;br /&gt;
Other things that can be controlled through SMAPI, but are not supported in this version of the driver, include PCI bus power saving, CPU power saving control and fan control (the latter is available through an [[How to control fan speed|alternative method]]). See the included README file for more information.&lt;br /&gt;
&lt;br /&gt;
===Conflict with &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt;===&lt;br /&gt;
The extended battery status function conflicts with the [[HDAPS|hdaps]] kernel module (they use the same IO ports). &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt; package includes a patch against &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt; to make it compatible with &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt;. To build the patched version, append the &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; parameter to the &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; command, for example: {{cmdroot|1=make load HDAPS=1}} (see [[#Installation|Installation]] above).&lt;br /&gt;
&lt;br /&gt;
If you don't do that, you will not be able tp load &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt; (and its support module &amp;lt;tt&amp;gt;tp_base&amp;lt;/tt&amp;gt;) when &amp;lt;tt&amp;gt;hdaps&amp;lt;/tt&amp;gt; is loaded, and vice versa. You can use &amp;lt;tt&amp;gt;rmmod&amp;lt;/tt&amp;gt; to switch between these modules.&lt;br /&gt;
&lt;br /&gt;
Note that some of the battery status is also visible through ACPI ({{path|/proc/acpi/battery/*}}), independently of &amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Model-specific status===&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|+&amp;lt;tt&amp;gt;tp_smapi&amp;lt;/tt&amp;gt; feature support matrix&lt;br /&gt;
|-&lt;br /&gt;
! &amp;amp;times; &lt;br /&gt;
! &amp;lt;tt&amp;gt;start_charge_&amp;lt;br /&amp;gt;thresh&amp;lt;/tt&amp;gt; &lt;br /&gt;
!           &amp;lt;tt&amp;gt;stop_charge_&amp;lt;br /&amp;gt;thresh&amp;lt;/tt&amp;gt;&lt;br /&gt;
!                      &amp;lt;tt&amp;gt;inhbit_charge_&amp;lt;br /&amp;gt;minutes&amp;lt;/tt&amp;gt;&lt;br /&gt;
!                                   &amp;lt;tt&amp;gt;force_discharge&amp;lt;/tt&amp;gt;&lt;br /&gt;
!                                                battery status files&lt;br /&gt;
!                                                             &amp;lt;tt&amp;gt;cd_speed&amp;lt;/tt&amp;gt;&amp;lt;br \&amp;gt;&amp;lt;font size=&amp;quot;-2&amp;quot;&amp;gt;(see [[#Enabling_this_feature|note]] above)&amp;lt;/font&amp;gt;&lt;br /&gt;
!                                                                       Notes&lt;br /&gt;
|-&lt;br /&gt;
! colspan=8 style=&amp;quot;text-align:center;background:#efefef;&amp;quot; | A series&lt;br /&gt;
|-&lt;br /&gt;
! {{A30}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! colspan=8 style=&amp;quot;text-align:center;background:#efefef;&amp;quot; | G series&lt;br /&gt;
|-&lt;br /&gt;
! {{G41}}&lt;br /&gt;
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! colspan=8 style=&amp;quot;text-align:center;background:#efefef;&amp;quot; | R series&lt;br /&gt;
|-&lt;br /&gt;
! [[:Category:R31|R31]]&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || No SMAPI BIOS&lt;br /&gt;
|-&lt;br /&gt;
! {{R40}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{R50}}&lt;br /&gt;
| {{Cunk}} || {{Cno}}  || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{R50p}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{R51}}&lt;br /&gt;
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{R52}}&lt;br /&gt;
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! colspan=8 style=&amp;quot;text-align:center;background:#efefef;&amp;quot; | T series&lt;br /&gt;
|-&lt;br /&gt;
! {{T22}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T23}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T40}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T40p}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T41}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T41p}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T42}}&lt;br /&gt;
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T42p}}&lt;br /&gt;
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T43}}&lt;br /&gt;
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{T43p}}&lt;br /&gt;
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||&lt;br /&gt;
|-&lt;br /&gt;
! colspan=8 style=&amp;quot;text-align:center;background:#efefef;&amp;quot; | X series&lt;br /&gt;
|-&lt;br /&gt;
! {{X24}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{X31}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{X32}}&lt;br /&gt;
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cunk}} || {{Cunk}} ||&lt;br /&gt;
|-&lt;br /&gt;
! {{X40}}&lt;br /&gt;
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || BIOS v2.03, EC v1.60&lt;br /&gt;
|-&lt;br /&gt;
! {{X41}}&lt;br /&gt;
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please update the above and report your experience on the [[Talk:tp_smapi|discussion]] page. If the module loads but gives a &amp;quot;&amp;lt;tt&amp;gt;not supported&amp;lt;/tt&amp;gt;&amp;quot; or &amp;quot;&amp;lt;tt&amp;gt;not implementeded&amp;lt;/tt&amp;gt;&amp;quot; when you try to use some specific file in {{path|/sys/devices/platform/smapi/}}, please report the &amp;lt;tt&amp;gt;dmesg&amp;lt;/tt&amp;gt; output and whether the corresponding functionality is available under Windows - maybe your ThinkPad just can't do that.&lt;br /&gt;
&lt;br /&gt;
[[Category:Drivers]] [[Category:Patches]]&lt;br /&gt;
&lt;br /&gt;
===Tools using this driver===&lt;br /&gt;
&lt;br /&gt;
The driver's interface can be accessed directly through the files under {{path|/sys/devices/platform/smapi}}, or via the following tools:&lt;br /&gt;
* [[KThinkBat]] - display battery status on the KDE &amp;lt;tt&amp;gt;kicker&amp;lt;/tt&amp;gt; panel.&lt;br /&gt;
* [[gkrellm-ThinkBat]] - battery status plugin for Gkrellm2&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=HDAPS&amp;diff=21375</id>
		<title>HDAPS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=HDAPS&amp;diff=21375"/>
		<updated>2006-04-05T16:05:41Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Project Homepage / Availability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
=== HDAPS - IBM Active Protection System Linux Driver ===&lt;br /&gt;
This is the Linux driver for monitoring the acceleratometer known as [[Active Protection System|IBM Active Protection System]].&lt;br /&gt;
&lt;br /&gt;
The driver only enables reading of the acceleration data. It does '''not''' perform [[#Harddisk Protection|automatic disk head parking]]. But there are already some other useful [[#Applications|applications]] for HDAPS, using the {{path|/sys}} interface it provides.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Features ===&lt;br /&gt;
*provides accelerometer values via sysfs&lt;br /&gt;
*provides a joystick type input device&lt;br /&gt;
&lt;br /&gt;
=== Project Homepage / Availability ===&lt;br /&gt;
*[http://hdaps.sourceforge.net/ Project Homepage]&lt;br /&gt;
*The driver is included in the 2.6-mm series of kernels since August, 26th 2005.&lt;br /&gt;
*The driver is now in the mainline (2.6.14). (use as modul if you want use tp_smapi, Gentoo and X41)&lt;br /&gt;
&lt;br /&gt;
=== Status ===&lt;br /&gt;
A driver is included in recent Linux kernels and is actively maintained. &lt;br /&gt;
&lt;br /&gt;
=== Harddisk Protection ===&lt;br /&gt;
As mentioned above, the hdaps kernel driver is only responsible for reading the accelerometer data and exporting it through the sysfs interface. In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
See [[How to protect the harddisk through APS]].&lt;br /&gt;
&lt;br /&gt;
=== Input device support ===&lt;br /&gt;
The hdaps driver in the lastest kernels (2.6.14 and later?) also exports a joystick type input device, which can be used by games.&lt;br /&gt;
&lt;br /&gt;
=== Applications ===&lt;br /&gt;
====Disk head parking====&lt;br /&gt;
* Kernel patch&lt;br /&gt;
**[http://lwn.net/Articles/154923/ disk park patch] &amp;lt;tt&amp;gt;an experimental patch for parking the disk (Linux 2.6.14 for 2.6.15 see below)&amp;lt;/tt&amp;gt;&lt;br /&gt;
**[http://jenster.dyndns.org/files/blk_freeze-01-nodetection-for-2.6.14.patch disk park patch adapted for the t41p model] &amp;lt;tt&amp;gt; kernel 2.6.14 *([http://sourceforge.net/mailarchive/message.php?msg_id=13214288 capability detection disabled], no libata support)&amp;lt;/tt&amp;gt;&lt;br /&gt;
**[http://jenster.dyndns.org/files/blk_freeze-01-nodetection-for-2.6.15.patch disk park patch adapted for the t41p model] &amp;lt;tt&amp;gt; kernel 2.6.15 *([http://sourceforge.net/mailarchive/message.php?msg_id=13214288 capability detection disabled], no libata support)&amp;lt;/tt&amp;gt;&lt;br /&gt;
**[http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch sata/ide disk protection patch for 2.6.15]&lt;br /&gt;
**[http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch Latest sata/ide disk protection patch for 2.6.16]&lt;br /&gt;
*Userspace daemon&lt;br /&gt;
**[http://www.dresco.co.uk/hdaps/hdapsd-20060326.c Latest userspace parking daemon]&lt;br /&gt;
*GUI monitoring&lt;br /&gt;
**[http://www.oakcourt.dyndns.org/projects/khdapsmon/ khdapsmon] &amp;lt;tt&amp;gt;KDE System Tray app similar to the Windows one (also at [http://www.kde-apps.org/content/show.php?content=34134 kde-apps.org])&amp;lt;/tt&amp;gt;&lt;br /&gt;
**[http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz gnome-hdaps-applet] &amp;lt;tt&amp;gt;visual display of disk protection status in gnome panel&amp;lt;/tt&amp;gt;&lt;br /&gt;
See [[How to protect the harddisk through APS]] for more information.&lt;br /&gt;
&lt;br /&gt;
====Security &amp;amp; safety====&lt;br /&gt;
*[[Script for theft alarm using HDAPS]]&lt;br /&gt;
&lt;br /&gt;
====Tilt monitoring====&lt;br /&gt;
*[http://www.mulliner.org/collin/gkibm-acpi.php gkhdaps] &amp;lt;tt&amp;gt;a GKrellM applet displaying tilt data&amp;lt;/tt&amp;gt;&lt;br /&gt;
*[http://rlove.org/log/2005082203.html gnome-tilt] &amp;lt;tt&amp;gt;a gnome applet showing tilt data&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Visualisation (of ThinkPad orientation)====&lt;br /&gt;
*[http://rlove.org/log/2005082401.html hdaps-gl] &amp;lt;tt&amp;gt;a little app animating a 3D-ThinkPad&amp;lt;/tt&amp;gt;&lt;br /&gt;
*[https://sourceforge.net/project/showfiles.php?group_id=138242 hdapsgl-applet] &amp;lt;tt&amp;gt; a GNOME applet animating a 3D-ThinkPad&amp;lt;/tt&amp;gt;&lt;br /&gt;
*[https://sourceforge.net/project/showfiles.php?group_id=138242 wmadhps] &amp;lt;tt&amp;gt;a WindowMaker DockApp animating a 3D-ThinkPad&amp;lt;/tt&amp;gt;&lt;br /&gt;
*[http://www.cs.cmu.edu/~ecc/gyro.tar.gz OpenGL gyroscope hack] &amp;lt;tt&amp;gt;keeps your display levelled when tilting the ThinkPad&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Games====&lt;br /&gt;
*Robert Love mentions a [http://icculus.org/neverball/ Neverball] patch on [http://rlove.org/log/2005100302.html his blog] to keep the display aligned. However, the link there seems broken.&lt;br /&gt;
&lt;br /&gt;
=== Interesting links related to this project ===&lt;br /&gt;
* [https://lists.sourceforge.net/lists/listinfo/hdaps-devel HDAPS mailinglist and its archive]&lt;br /&gt;
* #hdaps channel on irc.freenode.org&lt;br /&gt;
* [https://sourceforge.net/projects/hdaps/ hdaps projects] overview of userspace programs using hdaps&lt;br /&gt;
* [http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=TPAD-HDFIRM IBM ThinkPads hardware drive firmware site]&lt;br /&gt;
* [http://www.paul.sladen.org/thinkpad-r31/accelerometer.html http://www.paul.sladen.org/thinkpad-r31/accelerometer/]&lt;br /&gt;
* http://bugs.gentoo.org/show_bug.cgi?id=100167 Gentoo ebuild for hdaps driver and daemon including a initscript&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:T60p]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]] [[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21374</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21374"/>
		<updated>2006-04-05T16:03:33Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Installing hdapsd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
0.) Add hdapsd support in your kernel, as far as I can remember: device drivers -&amp;gt; hardware monitoring -&amp;gt; ... (you need it as modul if you want to use tp_smapi and hdaps, see tp_smapi topic)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Make portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles: &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21373</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21373"/>
		<updated>2006-04-05T15:59:33Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Installing hdapsd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Make portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles: &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Write me an e-mail (abartel[Ã¤d]htwm.de), if you want to get my hdapsd-20060326.ebuild and please upload it (It's illagal from work)&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21372</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21372"/>
		<updated>2006-04-05T15:55:34Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* How APS works in Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels). (As a modul if you want to use tp_smapi (Gentoo-Linux))&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Make portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles: &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21371</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21371"/>
		<updated>2006-04-05T15:52:50Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Patching the kernel and enabling the drivers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels).&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
make clean&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make modules_install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Make portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles: &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21370</id>
		<title>How to protect the harddisk through APS</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_protect_the_harddisk_through_APS&amp;diff=21370"/>
		<updated>2006-04-05T15:51:44Z</updated>

		<summary type="html">&lt;p&gt;Tava: /* Configuring hdapsd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page tells you how to make the [[Active Protection System]] work under Linux to protect your harddrive from damage in case of a notebook drop or other kind of impact while it is running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How APS works in Linux ==&lt;br /&gt;
APS in Linux consists of four components on the software side:&lt;br /&gt;
* The [[HDAPS]] driver (included in recent kernels).&lt;br /&gt;
* The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; disk protection kernel patch (available [http://www.dresco.co.uk/hdaps/hdaps_protect.20060118.patch for kernel 2.6.15] and [http://www.dresco.co.uk/hdaps/hdaps_protect.20060326.patch for kernel 2.6.16]; see [[HDAPS#Disk_head_parking|here]] for other versions)&lt;br /&gt;
* The [http://www.dresco.co.uk/hdaps/hdapsd-20060326.c &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;] disk protection userspace daemon&lt;br /&gt;
* Optional: the [http://www.oakcourt.dyndns.org/projects/khdapsmon/ &amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; KDE System Tray applet] or the [http://www.dresco.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
The [[HDAPS|HDAPS driver]] exports a sysfs interface providing the acceleration values.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; kernel patch exports a sysfs interface that enables an ide or sata disk to be protected by a userspace process.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; userspace daemon monitors the acceleration values through the HDAPS interface and automatically initiates disk protection through the hdaps_protect interface - given that the movement exceeds a user specified threshold.&lt;br /&gt;
&lt;br /&gt;
The optional KDE/GNOME applets provide a visual indication of the disk protection status and also a graphical interface for adjusting configuration options for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
As mentioned above, the hdaps kernel driver found in recent kernels is only responsible for reading the accelerometer data and exporting it through the sysfs interface. &lt;br /&gt;
{{NOTE|1=If you use [[tp_smapi]], remember to include the option &amp;lt;tt&amp;gt;HDAPS=1&amp;lt;/tt&amp;gt; when [[Tp_smapi#Installation|installing tp_smapi]].}}&lt;br /&gt;
In order to use this information to protect the disk, some additional steps are required.&lt;br /&gt;
&lt;br /&gt;
* Download and build the latest hdaps_protect disk protection kernel patches.&lt;br /&gt;
* Enable the drivers in the kernel (requires kernel rebuild).&lt;br /&gt;
* Download, build and configure the hdapsd userspace daemon.&lt;br /&gt;
* Download and build one of the applets to get a real-time representation of the disk protection status.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
The latest versions of &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;gnome-hdaps-applet&amp;lt;/tt&amp;gt; are available at [http://www.dresco.co.uk/hdaps]..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;khdapsmon&amp;lt;/tt&amp;gt; can befound [http://www.oakcourt.dyndns.org/projects/khdapsmon/ here].&lt;br /&gt;
&lt;br /&gt;
{{Debian}} source and sid binary packages for &amp;lt;tt&amp;gt;hdapsd&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;hdaps_protect&amp;lt;/tt&amp;gt; patches (kernel-patch format) are available via APT access:&lt;br /&gt;
&lt;br /&gt;
 deb http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
 deb-src http://www.oakcourt.dyndns.org/debian/ ./&lt;br /&gt;
&lt;br /&gt;
=== Patching the kernel and enabling the drivers ===&lt;br /&gt;
&lt;br /&gt;
As root go to /usr/src/linux&lt;br /&gt;
&lt;br /&gt;
{{cmdroot|patch -p1 &amp;lt; ~/hdaps_protect.20060118.patch}} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Todo|tell about how to patch the kernel and what needs to be enabled afterwards}}&lt;br /&gt;
==== Problem with unload capabilities check ====&lt;br /&gt;
&lt;br /&gt;
After installation, you may get the following kernel message when the disk is protected (e.g., via {{cmdroot|echo 1 &amp;gt; /sys/block/sda/queue/protect}}):&lt;br /&gt;
&lt;br /&gt;
 ata_scsi_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 scsi_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 idedisk_issue_protect_fn(): unload support NOT reported..&lt;br /&gt;
 ide_protect_queue(): head park not requested, used standby!..&lt;br /&gt;
&lt;br /&gt;
{{WARN|Using HDAPS in the above state may cause frequent drive spin downs, thereby wearing out your hard disk.}}&lt;br /&gt;
&lt;br /&gt;
If you see this, and you are sure that your drive actually does support unloading (all original drives sold with HDAPS-equipped ThinkPads do), then add the following patch ''on top'' of the above patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/ide/ide-disk.c linux-2.6.15.hdaps/drivers/ide/ide-disk.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/ide/ide-disk.c	2006-01-18 07:11:54.000000000 +0000&lt;br /&gt;
@@ -869,7 +869,7 @@&lt;br /&gt;
 	else&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;idedisk_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
-	return ide_protect_queue(q, (drive-&amp;gt;id-&amp;gt;cfsse &amp;amp; (1 &amp;lt;&amp;lt; 13)) ? 1: 0);&lt;br /&gt;
+	return ide_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int idedisk_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
diff -u linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c&lt;br /&gt;
--- linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
+++ linux-2.6.15.hdaps/drivers/scsi/libata-scsi.c	2006-01-18 07:15:31.000000000 +0000&lt;br /&gt;
@@ -661,7 +661,7 @@&lt;br /&gt;
 		printk(KERN_DEBUG &amp;quot;ata_scsi_issue_protect_fn(): unload support NOT reported..\n&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	/* call scsi_protect_queue, requesting either unload or standby */&lt;br /&gt;
-	return scsi_protect_queue(q, ata_id_has_unload(dev-&amp;gt;id) ? 1 : 0);&lt;br /&gt;
+	return scsi_protect_queue(q, 1);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int ata_scsi_issue_unprotect_fn(request_queue_t *q)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Drives on which the capabilities check patch is needed'''&lt;br /&gt;
* Hitachi HTS726060M9AT00 (7K60) on ThinkPad {{T43}}&lt;br /&gt;
&lt;br /&gt;
=== Installing hdapsd ===&lt;br /&gt;
Gentoo users can try this ebuild: http://bugs.gentoo.org/show_bug.cgi?id=119845&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Gentoo: (works fine with IBM X41 25254CG)&lt;br /&gt;
&lt;br /&gt;
1.) Download the ebuild&lt;br /&gt;
&lt;br /&gt;
2.) Makes known the portage an extern ebuild path and add the following line to /etc/make.conf:&lt;br /&gt;
&lt;br /&gt;
PORTDIR_OVERLAY=&amp;quot;/usr/local/portage/&amp;quot; (or any other location)&lt;br /&gt;
&lt;br /&gt;
3.) Creates directory /usr/local/portage and /usr/local/portage/app-laptop/&lt;br /&gt;
&lt;br /&gt;
4.) Copy downloaded ebuild to /usr/local/portage/app-laptop (/usr/local/portage/app-laptop/hdapsd should now exists)&lt;br /&gt;
&lt;br /&gt;
5.) Make portage known the new ebuild and creat digist with: &lt;br /&gt;
&lt;br /&gt;
ebuild /usr/local/portage/app-laptop/hdapsd/hdapsd-20060326.ebuild digest&lt;br /&gt;
&lt;br /&gt;
6.) Optional: Copy source file to portage distfiles: &lt;br /&gt;
&lt;br /&gt;
cp hdapsd-20060326.c /usr/portage/distfiles&lt;br /&gt;
&lt;br /&gt;
7.) Accept the x86 keyword for this package: echo &amp;quot;app-laptop/hdapsd ~x86&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
8.) Install hdapsd with: emerge hdapsd&lt;br /&gt;
&lt;br /&gt;
9.) Edit the /etc/conf.d/hdapsd file (change your harddrive if neccessary: my is sda, and change the value from 5, 5 is to sensitive, 12 is a good value in my opinion)&lt;br /&gt;
&lt;br /&gt;
10.) start deamon with: /etc/init.d/hdapsd start&lt;br /&gt;
&lt;br /&gt;
11.) Optional: add to default runlevel: rc-update add hdapsd default, rc-update add hdapsd battery&lt;br /&gt;
&lt;br /&gt;
=== Building an applet ===&lt;br /&gt;
====Building khdapsmon====&lt;br /&gt;
Where is Gentoo ebuild http://bugs.gentoo.org/show_bug.cgi?id=124175.&lt;br /&gt;
&lt;br /&gt;
====Building gnome-hdaps-applet====&lt;br /&gt;
{{Todo|tell people what to do}}&lt;br /&gt;
&lt;br /&gt;
==Further Information==&lt;br /&gt;
*Additonal information and support is available through the [[Mailinglists#HDAPS Developers Mailinglist|hdaps-devel]] mailinglist and its archive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:T60]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:X60]] [[Category:X60s]] [[Category:Z60m]] [[Category:Z60t]]&lt;/div&gt;</summary>
		<author><name>Tava</name></author>
		
	</entry>
</feed>