Author: brucec
Date: Thu Nov  4 20:31:12 2010
New Revision: 214807
URL: http://svn.freebsd.org/changeset/base/214807

Log:
  r214781 caused the timer value to be rounded down, so that if the user asked
  for 59 minutes 30 was sent to the drive. The timer value is now always
  rounded up.
  
  Reported by: mav

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c   Thu Nov  4 20:22:44 2010        
(r214806)
+++ head/sbin/camcontrol/camcontrol.c   Thu Nov  4 20:31:12 2010        
(r214807)
@@ -4312,18 +4312,16 @@ atapm(struct cam_device *device, int arg
                cmd = ATA_SLEEP;
                t = -1;
        }
+
        if (t < 0)
                sc = 0;
        else if (t <= (240 * 5))
-               sc = t / 5;
-       else if (t == (252 * 5))
+               sc = (t + 4) / 5;
+       else if (t <= (252 * 5))
                /* special encoding for 21 minutes */
                sc = 252;
-       else if (t < (30 * 60))
-               /* no encoding exists for 22-29 minutes, so set to 30 mins */
-               sc = 241;
        else if (t <= (11 * 30 * 60))
-               sc = t / (30 * 60) + 240;
+               sc = (t - 1) / (30 * 60) + 241;
        else
                sc = 253;
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to