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 }.
This commit is contained in:
Matthew Jackson
2026-06-29 15:09:22 -07:00
parent b8aa3e68de
commit 545d2c0c73
+9 -4
View File
@@ -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<Vid, UnlockError> {
) -> std::result::Result<Unlocked, UnlockError> {
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.