From e1a1f730be28f781e561a2460426282bd48dfb6a Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:54:12 -0700 Subject: [PATCH] v0.13.35: pause 3s after first MEDIUM ERROR before retry to prevent USB bridge crash --- Cargo.toml | 2 +- src/disc/mod.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2e1aa65..bcd3dd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libfreemkv" -version = "0.13.34" +version = "0.13.35" edition = "2024" rust-version = "1.86" license = "AGPL-3.0-only" diff --git a/src/disc/mod.rs b/src/disc/mod.rs index 8aa4469..e71f379 100644 --- a/src/disc/mod.rs +++ b/src/disc/mod.rs @@ -1441,10 +1441,16 @@ impl Disc { if err.is_marginal_read() || err.scsi_sense().is_some_and(|s| s.is_medium_error()) { - // Disc-related error — try 1 sector instead use_single = true; consecutive_good = 0; - // Don't advance pos — retry this location at 1 sector + if err.scsi_sense().is_some_and(|s| s.is_medium_error()) + && opts + .halt + .as_ref() + .is_none_or(|h| !h.load(std::sync::atomic::Ordering::Relaxed)) + { + std::thread::sleep(std::time::Duration::from_secs(3)); + } continue; } else { // Non-recoverable transport error — bail