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 error::Result;
use libfreemkv::aacs::Vid; use libfreemkv::aacs::Vid;
use libfreemkv::{DriveId, ScsiTransport, UnlockError, Unlocker}; use libfreemkv::{DriveId, ScsiTransport, Unlocked, UnlockError, Unlocker};
use scsi::DataDirection; use scsi::DataDirection;
/// The LibreDrive unlocker. /// The LibreDrive unlocker.
@@ -147,7 +147,7 @@ impl Unlocker for LibreDrive {
&self, &self,
scsi: &mut dyn ScsiTransport, scsi: &mut dyn ScsiTransport,
id: &DriveId, id: &DriveId,
) -> std::result::Result<Vid, UnlockError> { ) -> std::result::Result<Unlocked, UnlockError> {
let Some(m) = profile::find_bundled(id) else { let Some(m) = profile::find_bundled(id) else {
// matches() returned true but the profile vanished — this unlocker // matches() returned true but the profile vanished — this unlocker
// cannot put the firmware into extended mode. // cannot put the firmware into extended mode.
@@ -167,8 +167,13 @@ impl Unlocker for LibreDrive {
// zone speeds internally (best-effort — calibration failure must not // zone speeds internally (best-effort — calibration failure must not
// fail an otherwise-good unlock). // fail an otherwise-good unlock).
let _ = mt.probe_disc(scsi); let _ = mt.probe_disc(scsi);
// An unlocked drive must hand back its Volume ID in the same step. // An unlocked drive must hand back its Volume ID in the same step. The
self.read_oem_vid(scsi, id) // 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. /// Raise the drive to its maximum read speed.