1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

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
This commit is contained in:
Rebecca Cran 2010-11-04 20:31:12 +00:00
parent cbb75751a7
commit f974f3ffa1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214807

View File

@ -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;