Re: IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer))

Jens Axboe
2005-07-04T11:09:04Z

On Mon, Jul 04 2005, Lenz Grimmer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Jens Axboe wrote:
>
> > It isn't too pretty to rely on such unreliable timing anyways. I'm
> > not too crazy about spinning the disk down either, it's useless wear
> > compared to just parking the head.
>
> Fully agreed, and that's the approach the IBM Windows driver seems to
> take - you just hear the disk park its head when the sensor kicks in
> (you can hear it) - the disk does not spin down when this happens.
>
> Could this be some reserved ATA command that only works with certain#
> drives?

Perhaps the IDLE or IDLEIMMEDIATE commands imply a head parking, that
would make sense. As you say, you can hear a drive parking its head.
Here's a test case, it doesn't sound like it's parking the hard here.

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/hdreg.h>

int main(int argc, char *argv[])
{
char cmd[4] = { 0xe1, 0, 0, 0 };
int fd;

if (argc < 2) {
printf("%s <dev>\n", argv[0]);
return 1;
}

fd = open(argv[1], O_RDONLY);
if (fd == -1) {
perror("open");
return 1;
}

if (ioctl(fd, HDIO_DRIVE_CMD, cmd))
perror("ioctl");

close(fd);
return 0;
}

--
Jens Axboe