Skip to content

Commit 1ee47ae

Browse files
committed
Fix indefinite looping while guessing head stepping rate.
The old stepping code uses the cylinder number from the disk's ID Record to switch stepping rates. Some disks this information is non-conventional or intentionally wrong which can lead to the old heuristic to make incorrect assumptions flipping the rate back and forth. The new approach limits still uses the ID record cylinder number, but only when transitioning from step 2 to step 1 breaking the loop.
1 parent 7eeceb5 commit 1ee47ae

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cw2dmk.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,11 +2448,10 @@ main(int argc, char** argv)
24482448
if (guess_steps) {
24492449
if (track == 3) guess_steps = 0;
24502450
if (steps == 1) {
2451-
if ((track & 1) &&
2452-
(good_sectors == 0 ||
2453-
cylseen == track - 1 || cylseen == track + 1)) {
2451+
if ((track & 1) && (good_sectors == 0)) {
24542452
msg(OUT_QUIET + 1,
24552453
"[double-stepping apparently needed; restarting]\n");
2454+
guess_steps = 0;
24562455
steps = 2;
24572456
if (guess_tracks) tracks = TRACKS_GUESS / steps;
24582457
goto restart;

0 commit comments

Comments
 (0)