From 545d2c0c73dca6dfab1a49930e7386cee96e9bb0 Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:09:22 -0700 Subject: [PATCH] unlock: return Unlocked per the generalized libfreemkv trait libfreemkv's Unlocker::unlock now returns Unlocked { vid, read_data_key } rather than a bare Vid. The firmware route serves clear content, so it reports { vid: Some(oem_vid), read_data_key: None }. --- ld/src/lib.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ld/src/lib.rs b/ld/src/lib.rs index 1500a5e..5ca7cd4 100644 --- a/ld/src/lib.rs +++ b/ld/src/lib.rs @@ -27,7 +27,7 @@ mod platform; use error::Result; use libfreemkv::aacs::Vid; -use libfreemkv::{DriveId, ScsiTransport, UnlockError, Unlocker}; +use libfreemkv::{DriveId, ScsiTransport, Unlocked, UnlockError, Unlocker}; use scsi::DataDirection; /// The LibreDrive unlocker. @@ -147,7 +147,7 @@ impl Unlocker for LibreDrive { &self, scsi: &mut dyn ScsiTransport, id: &DriveId, - ) -> std::result::Result { + ) -> std::result::Result { let Some(m) = profile::find_bundled(id) else { // matches() returned true but the profile vanished — this unlocker // cannot put the firmware into extended mode. @@ -167,8 +167,13 @@ impl Unlocker for LibreDrive { // zone speeds internally (best-effort — calibration failure must not // fail an otherwise-good unlock). let _ = mt.probe_disc(scsi); - // An unlocked drive must hand back its Volume ID in the same step. - self.read_oem_vid(scsi, id) + // An unlocked drive must hand back its Volume ID in the same step. The + // firmware route serves CLEAR content, so it carries no bus key. + let vid = self.read_oem_vid(scsi, id)?; + Ok(Unlocked { + vid: Some(vid), + read_data_key: None, + }) } /// Raise the drive to its maximum read speed.