From b36896564fde33fb71c5c3a307f2c91528015ee8 Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Mon, 29 Jun 2026 21:47:50 -0700 Subject: [PATCH] disc: log adaptive patch speed transitions; issue SET CD SPEED max unconditionally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two recovery-path fixes: - patch: log the per-range speed transitions (INFO, phase="patch_speed") — each range enters at 0xFFFF (max) and drops to 0x0000 (slow recovery) on its first read failure. Previously the adaptive-speed behavior was invisible in the logs. - drive init: issue the generic SET CD SPEED max UNCONDITIONALLY at drive-open, not only when a firmware unlocker matched. A stock-mode BD/UHD drive (no firmware unlock) was left riplocked because the call sat inside the unlocker-matched branch. --- src/disc/patch.rs | 16 ++++++++++++++++ src/drive/mod.rs | 11 +++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/disc/patch.rs b/src/disc/patch.rs index 018c8a0..c83ca6d 100644 --- a/src/disc/patch.rs +++ b/src/disc/patch.rs @@ -1957,6 +1957,14 @@ impl Disc { // (below), dropping to the slow recovery speed for the rest of the // range and arming the inter-range cooldown. reader.set_speed(0xFFFF); + tracing::info!( + target: "freemkv::disc", + phase = "patch_speed", + range_lba = *range_pos / 2048, + range_sectors, + speed = "0xFFFF", + "patch: range entering at MAX read speed (drops to slow recovery on first failure)" + ); state.current_batch = initial_batch; let mut range_slowed = false; loop { @@ -2082,9 +2090,17 @@ impl Disc { // Idempotent — only the first failure issues SET CD SPEED. if !range_slowed { reader.set_speed(0x0000); + tracing::info!( + target: "freemkv::disc", + phase = "patch_speed", + lba, + speed = "0x0000", + "patch: range dropped to slow recovery speed on first read failure" + ); range_slowed = true; cooldown_pending = true; } + match handle_read_failure( &mut state, &frame, diff --git a/src/drive/mod.rs b/src/drive/mod.rs index 8511e93..4bcd92c 100644 --- a/src/drive/mod.rs +++ b/src/drive/mod.rs @@ -431,11 +431,14 @@ impl Drive { if let Some(vid) = unlocked.vid { self.oem_vid = Some(vid); } - // Now that the drive is unlocked, raise it to its maximum read speed - // with a generic SET CD SPEED. Best-effort: a failure here must NOT - // fail the rip — a slow drive still rips. - self.set_speed(crate::speed::DriveSpeed::Max.to_kbps()); } + // Raise the drive to its maximum read speed with a generic SET CD SPEED — + // UNCONDITIONALLY, whether or not an unlocker matched. A stock-mode BD/UHD + // drive (no firmware unlocker) still wants max speed; gating this on an + // unlocker match left such drives riplocked. (DVD returns earlier in + // stock mode; its sweep sets DVD speed separately.) Best-effort: a + // failure here must NOT fail the rip — a slow drive still rips. + self.set_speed(crate::speed::DriveSpeed::Max.to_kbps()); let r: Result<()> = Ok(()); tracing::info!( target: "freemkv::drive",