Skip to content

Commit

Permalink
Fix indefinite looping while guessing head stepping rate.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
qbarnes committed Apr 24, 2024
1 parent 7eeceb5 commit 1ee47ae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cw2dmk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2448,11 +2448,10 @@ main(int argc, char** argv)
if (guess_steps) {
if (track == 3) guess_steps = 0;
if (steps == 1) {
if ((track & 1) &&
(good_sectors == 0 ||
cylseen == track - 1 || cylseen == track + 1)) {
if ((track & 1) && (good_sectors == 0)) {
msg(OUT_QUIET + 1,
"[double-stepping apparently needed; restarting]\n");
guess_steps = 0;
steps = 2;
if (guess_tracks) tracks = TRACKS_GUESS / steps;
goto restart;
Expand Down

0 comments on commit 1ee47ae

Please sign in to comment.