This one time, at band camp, Andrew Pollock said: > On Fri, Sep 29, 2006 at 09:32:20AM +0100, Stephen Gran wrote: > > This one time, at band camp, Andrew Pollock said: > > > Whilst playing around with hdparm -C on some IDE drives connected via > > > IDE-USB adapters, it became apparent that it was reporting standby, when > > > it really should have been reporting unknown. This is apparent when > > > running hdparm under strace. It gets an ENOTTY back from the ioctl() > > > call, and then goes on to report the drive being in a standby state. It > > > should, according to the manpage, be reporting "unknown". > > > > Can yuo send me the complete strace output? What you're reporting is > > not exactly what I see in the code, so I'd like to look it over. > > Attached. > > regards > > Andrew
> write(1, "/dev/sda:\n", 10) = 10
> ioctl(3, 0x31f, 0xafe04e40) = -1 EINVAL (Invalid argument)
> write(1, " drive state is: standby\n", 26) = 26
Ah. EINVAL makes a whole lot more sense than ENOTTY. I am going to
copy upstream on this and see where we get.
Can you try this patch and see if it reports correct behavior for you?
Index: hdparm.c
===================================================================
--- hdparm.c (revision 113)
+++ hdparm.c (working copy)
@@ -1237,7 +1237,7 @@
unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
const char *state;
if (ioctl(fd, HDIO_DRIVE_CMD, &args)
- && (args[0] == WIN_CHECKPOWERMODE2) /* try again with 0x98 */
+ && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
&& ioctl(fd, HDIO_DRIVE_CMD, &args)) {
if (errno != EIO || args[0] != 0 || args[1] != 0)
state = "unknown";
Mark, does this look OK to you?
--
-----------------------------------------------------------------
| ,''`. Stephen Gran |
| : :' : [EMAIL PROTECTED] |
| `. `' Debian user, admin, and developer |
| `- http://www.debian.org |
-----------------------------------------------------------------
signature.asc
Description: Digital signature

