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

From: Jens Axboe
Date: Mon Jul 04 2005 - 01:41:56 EST


On Mon, Jul 04 2005, Alejandro Bonilla wrote:
> Jens Axboe wrote:
>
> >On Mon, Jul 04 2005, Lenz Grimmer wrote:
> >
> >
> >>>I'll be working on adding sysfs stuff to it tomorrow so it's generally
> >>>useful (at least for monitoring things - not yet for parking disk
> >>>heads).
> >>>
> >>>
> >>Maybe there is some kind of all-purpose ATA command that instructs the
> >>disk drive to park the heads? Jens, could you give us a hint on how a
> >>userspace application would do that?
> >>
> >>
> >
> >Dunno if there's something that explicitly only parks the head, the best
> >option is probably to issue a STANDBY_NOW command. You can test this
> >with hdparm -y.
> >
> >
> This is exactly what I said. Use hdparm to make the HD park
> inmediatelly. I did send the email to the HDPARM developer, but he never
> replied. I asked him what would be the best way to make the HD park with
> no exception and then let it come back 5 or 10 seconds later.

IIRC, you don't have to do anything to wake up the drive after a
STANDBYNOW command, if you want to be on the safe side you just issue an
IDLEIMMEDIATE. So your code will look something like:

int drive_standby(int fd)
{
char foo[4] = { 0xe0, 0, 0, 0 };

return ioctl(fd, HDIO_DRIVE_CMD, &foo);
}

int drive_wakeup(int fd)
{
char foo[4] = { 0xe1, 0, 0, 0 };

return ioctl(fd, HDIO_DRIVE_CMD, &foo);
}

--
Jens Axboe

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