diff options
author | brucec <brucec@FreeBSD.org> | 2010-11-04 20:31:12 +0000 |
---|---|---|
committer | brucec <brucec@FreeBSD.org> | 2010-11-04 20:31:12 +0000 |
commit | 32571f05c0680c26d648e7d88cf05fe3e0ea5cf5 (patch) | |
tree | 6cd779f1e1d6968f203e248a57b97ea29ecbabd9 /sbin | |
parent | 9cd5f67510527aa0b7f37520b47354f9035ff84e (diff) | |
download | FreeBSD-src-32571f05c0680c26d648e7d88cf05fe3e0ea5cf5.zip FreeBSD-src-32571f05c0680c26d648e7d88cf05fe3e0ea5cf5.tar.gz |
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
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/camcontrol/camcontrol.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index bedd035..25f8777 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -4312,18 +4312,16 @@ atapm(struct cam_device *device, int argc, char **argv, 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; |