diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 17173edf8f5857f18625e9d4fa08a5d6e8ad21ca..47b148e093e50e9e17b3c369ed99d2761f057bb4 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.611 2007/04/20 20:41:00 shattered Exp $
+$Id: CHANGELOG,v 1.612 2007/04/27 08:52:44 geoffk1 Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [GK] Darwin: Improve handling of powered-down drives.
+
   [SS] CCISS physical drive enumeration method changed (incompatibly).
 
   [CF] Fixed smartd crash on missing '-s' directive argument.
diff --git a/sm5/os_darwin.cpp b/sm5/os_darwin.cpp
index 867f804da9c71bad9df6f77b9cf8cdd318069338..026ddecac73e8649dfd87f2d61ab6e83f0f96a43 100644
--- a/sm5/os_darwin.cpp
+++ b/sm5/os_darwin.cpp
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2004-6 Geoffrey Keating <geoffk@geoffk.org>
+ * Copyright (C) 2004-7 Geoffrey Keating <geoffk@geoffk.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
 
 #include <stdbool.h>
 #include <errno.h>
+#include <unistd.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <mach/mach_init.h>
@@ -43,7 +44,7 @@
 #include "os_darwin.h"
 
 // Needed by '-V' option (CVS versioning) of smartd/smartctl
-const char *os_XXXX_c_cvsid="$Id: os_darwin.cpp,v 1.18 2006/09/20 16:17:31 shattered Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_darwin.cpp,v 1.19 2007/04/27 08:52:44 geoffk1 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_DARWIN_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 // Print examples for smartctl.
@@ -333,7 +334,7 @@ ata_command_interface(int fd, smart_command_set command,
   IOATASMARTInterface **ifp = devices[fd].smartIf;
   IOATASMARTInterface *smartIf;
   IOReturn err;
-  int timeoutCount = 2;
+  int timeoutCount = 5;
   
   if (! ifp)
     return -1;
@@ -385,8 +386,9 @@ ata_command_interface(int fd, smart_command_set command,
 	{
 	  UInt32 dummy;
 	  err = smartIf->GetATAIdentifyData (ifp, data, 512, &dummy);
-	  if (err != kIOReturnSuccess)
-	    printf ("identify failed: %d\n", (int) err);
+	  if (err != kIOReturnSuccess && err != kIOReturnTimeout
+	      && err != kIOReturnNotResponding)
+	    printf ("identify failed: %#x\n", (unsigned) err);
 	  if (err == kIOReturnSuccess && isbigendian())
 	    {
 	      int i;
@@ -409,7 +411,10 @@ ata_command_interface(int fd, smart_command_set command,
        you get a timeout, you have to try again to get the actual
        command run, but the drive is already powering up so you can't
        use this for CHECK_POWER_MODE.  */
-  } while (err == kIOReturnTimeout && timeoutCount-- > 0);
+    if (err == kIOReturnTimeout || err == kIOReturnNotResponding)
+      sleep (1);
+  } while ((err == kIOReturnTimeout || err == kIOReturnNotResponding)
+	   && timeoutCount-- > 0);
   if (err == kIOReturnExclusiveAccess)
     errno = EBUSY;
   return err == kIOReturnSuccess ? 0 : -1;