lkml.org 
[lkml]   [2005]   [Jul]   [7]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 7 Jul 2005 10:03:23 +0200
FromJens Axboe <>
SubjectRe: IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer))
On Mon, Jul 04 2005, Jens Axboe wrote:
> 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.

ATA7 defines a park maneuvre, I don't know how well supported it is yet
though. You can test with this little app, if it says 'head parked' it
works. If not, it has just idled the drive.


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

int main(int argc, char *argv[])
{
	unsigned char buf[8];
	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;
	}
	memset(buf, 0, sizeof(buf));
	buf[0] = 0xe1;
	buf[1] = 0x44;
	buf[3] = 0x4c;
	buf[4] = 0x4e;
	buf[5] = 0x55;

	if (ioctl(fd, HDIO_DRIVE_TASK, buf)) {
		perror("ioctl");
		return 1;
	}
	if (buf[3] == 0xc4)
		printf("head parked\n");
	else
		printf("head not parked %x\n", buf[3]);
	close(fd);
	return 0;
}
-- 
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-07-07 10:06    [W:1.183 / U:0.320 seconds]
©2003-2008 Jasper Spaans