Active Protection System

From ThinkWiki
Jump to: navigation, search
IBM Active Protection System

The Active Protection System

With the new series of ThinkPads IBM introduced the Active Protection System (APS) in 2003. The APS is a protection system for the ThinkPad's internal harddrive. A sensor inside the ThinkPad recognizes when the notebook is accelerated. A software applet then is triggered to park the harddisk. This way the risk of data loss in case of when the notebook is dropped is significantly reduced since the read/write head of the harddrive is parked and hence can't crash onto the platter when the notebook drops onto the floor.

The hardware sensor is capable of not only recognizing acceleration of the notebook, but also (to a certain degree) of its whole orientation in space, relative to gravity's axis. Furthermore, having the actual control put into software, its functionality is extendable and it gives chance to implement features like the "ignore minor shocks" feature which is present in the Windows based control applet. (This feature prevents the harddrive from parking in case of minor regular shocks such as occur when in a train or car.)

The measurements are physically performed by an Analog Devices ADXL320 accelerometer chip, managed by the embedded controller.

Hard-disk Support

HD-APS requires a hard-disk with head unload ramp technology and also support on the hard-disk firmware to unload heads without flushing the disk cache. This is required, because as soon as the APS system detects a shock is imminent, the system has less than 500ms to prepare for the shock.

Unloading heads without flushing the cache is done using the optional Unload Immediate feature of the IDLE IMMEDIATE ATA command. It finishes whatever sector write is in-flight, and immediately moves the heads to the unload ramp. Without this command, hard-disk APS cannot be trusted, as disks with big caches can take a lot of time to write it all to disk.

So far, only hard-disks with IBM APS firmware, as well as the consumer Fujitsu HV2060AH/MHV2100AH/MHV2120AH HDs have been found to implement all the necessary functions. Head unload technology is reasonably common in modern laptop disks, but the APS firmware is very rare in regular consumer products. Please note that newer Apple notebooks also support APS, so it is somewhat likely that their disks also support unload immediate or a similar feature.

(Update: February, 2009) Meanwhile, other HDD manufacturers may have added the necessary support to their new products. E.g., Hitachi Travelstar 7K320 spec does mention some 'Idle Immediate with Unload Option' command. The description reads pretty much like what's needed for APS, though I don't want to drop my almost new TP just to field-test it.

Linux Support

Linux support is in development.

This feature definitely depends on software and there is no hardware or BIOS-only way of making it work. IBM made contradictory statements about their willingness to release the specifications of the hardware sensor and its API to the linux community or some developers. Although a lot of developers and other interested people from the OpenSource community actively contacted IBM to get the specs, in fact they never got them.

However, after first efforts of Amit Singh on a PowerBook and Mark Smith on a ThinkPad, the HDAPS project was founded to produce a linux kernel driver for the acceleration sensor and a user space application to monitor it. Later, a kernel patch to enable harddisk parking followed.

See How to protect the harddisk through APS for instructions and Problem with APS harddisk parking for Troubleshooting.

Furthermore, a list of alternative applications like theft alarm and others can be found on the HDAPS driver page.

Tilt detection field tests

Using Perl code for WinXP:

use Win32API::File qw(:ALL);
sub get_tilt {
      my $file = createFile("//./ShockMgr", "r ke") or die "Can't get ShockMgr device";
      DeviceIoControl($file, 0x733fc, [], 0, my($buf), 0x24, my($bytes), []);
      my @data = unpack "x4s*", $buf;
      return @data[1, 0];
}

my T42 gives values of roughly 490 when at rest in normal upright position with base parallel to the ground. As I gently tilt the T42 through all possible x or y angles, the values range from about 335-645, meaning a resolution of about 155 units per Earth gravity. This seems to suggest that the operating range of the APS is actually about +-3 gs, although the ADXL320 is supposed to allow +-5 gs.

As the tilt angle is the arcsine of the normalized APS reading, the Thinkpad is most tilt sensitive when in a normal upright position with base parallel to the ground. In this position, the tilt resolution is about 0.35 - 0.4 degrees. At maximum tilt, the resolution is much worse, about 6.5 degrees.

Shouldn't matter much, but my tests are at an elevation of about 60 meters above sea level.

More field tests

When placed on a reasonably flat and reasonably horizontal work surface my T43 provides readings of about x=503 and y=569. I wrote a command-line application in C# (using the .NET DllImport annotation to access the sensor.dll API) to log the sensor readings at some interval. With 150ms sampling I found the following extreme values: 335 to 654 for x, and 409 to 723 for y.

 x: 494.5   +/- 159.5
 y: 566.0   +/- 157.0

Based on the maximum and minimum x and y readings I calculated the above "zero" and range values in order to convert the sensor readings to degrees and wrapped this up in a small graphical application for Windows. My data, source code, executables and a complete description can be found here.

See also

  • HDAPS - IBM Active Protection System Linux Driver. Shows various applications of APS.

Related Links

Models featuring this Technology