unlock: add Unlocker::name() + report-only applies_to() for the matrix
Each unlocker now carries its own stable name() (the single source; apps never hardcode it) and a report-only applies_to() — phase-independent 'would this apply to this drive+disc', distinct from the dispatch-gated matches(). LibreDrive overrides applies_to to report on drive identity regardless of disc kind (its matches() is gated to the Unknown-kind init phase). Enables a registry-driven unlocker matrix.
This commit is contained in:
@@ -121,10 +121,22 @@ impl Unlocker for LibreDrive {
|
||||
/// probed (`kind == Unknown`) and keys off the drive identity. It must NOT
|
||||
/// fire during the later content-keyed dispatch (Aacs/Css), or a DVD/Blu-ray
|
||||
/// in a profiled drive would be re-firmware-unlocked.
|
||||
fn name(&self) -> &'static str {
|
||||
"LibreDrive"
|
||||
}
|
||||
|
||||
fn matches(&self, ctx: &UnlockCtx) -> bool {
|
||||
ctx.kind == crate::DiscKind::Unknown && profile::find_bundled(ctx.drive_id).is_some()
|
||||
}
|
||||
|
||||
/// For the report, the drive unlocker applies whenever it recognises the
|
||||
/// DRIVE — independent of disc kind (its live `matches` is gated to the
|
||||
/// Unknown-kind init phase, which would falsely read "no" once the disc kind
|
||||
/// is known).
|
||||
fn applies_to(&self, ctx: &UnlockCtx) -> bool {
|
||||
profile::find_bundled(ctx.drive_id).is_some()
|
||||
}
|
||||
|
||||
/// Firmware-unlock the drive and report its OEM Volume ID. The unlocked drive
|
||||
/// serves CLEAR content, so `drive_unlocked: true` and there is no bus key.
|
||||
///
|
||||
|
||||
+1
-4
@@ -290,10 +290,7 @@ fn load_from_str(data: &str) -> Result<Profiles> {
|
||||
/// profile; the looser pass lets a drive whose firmware date we don't have
|
||||
/// on file still match a same-model profile. All comparisons are
|
||||
/// whitespace-trimmed. Returns the first section that yields a match.
|
||||
pub fn find_by_drive_id(
|
||||
profiles: &Profiles,
|
||||
drive_id: &crate::DriveId,
|
||||
) -> Option<ProfileMatch> {
|
||||
pub fn find_by_drive_id(profiles: &Profiles, drive_id: &crate::DriveId) -> Option<ProfileMatch> {
|
||||
let v = drive_id.vendor_id.trim();
|
||||
let r = drive_id.product_revision.trim();
|
||||
let vs = drive_id.vendor_specific.trim();
|
||||
|
||||
Reference in New Issue
Block a user