ld: public profile catalog API + emulation feature; clippy-clean
Expose the LibreDrive profile catalog as a curated public API on `ld`: `ld::profiles()` returns the `Profiles` object (with `.get(drive_id)`) and `ld::profile(filter)` finds one — the catalog of supported drives, queried without unlocking. The unlock mechanism (firmware blobs, upload sequence, CDB wire format) stays private; `LibreDrive` is pub(crate), reached only via `all_unlockers()`. The unlock-handshake wire format the bdemu test-emulator needs to impersonate a drive (`UNLOCK_MARKER`, `is_unlock_read_buffer`) is behind a non-default `emulation` feature; the `cdb` module compiles only under it. Rename the `ScsiError` error variant to `Scsi` (matches css), gate the test-only `load_bundled` and `SCSI_STATUS_CHECK_CONDITION`. Clippy-clean in both feature configs; 86/89 tests pass.
This commit is contained in:
+13
-5
@@ -14,7 +14,13 @@ pub mod scsi;
|
||||
|
||||
mod aacs;
|
||||
mod css;
|
||||
mod ld;
|
||||
// `ld` is public ONLY for its drive-profile catalog (`ld::profiles` / the
|
||||
// `Profiles` object) and, under the `emulation` feature, the unlock-handshake
|
||||
// wire format the bdemu test-emulator needs. The unlocker impl itself
|
||||
// (`LibreDrive`) is `pub(crate)` — clients still reach unlockers only through
|
||||
// [`all_unlockers`]. `aacs` and `css` carry no such public catalog, so they
|
||||
// stay fully private.
|
||||
pub mod ld;
|
||||
|
||||
use scsi::ScsiTransport;
|
||||
|
||||
@@ -114,10 +120,12 @@ pub trait Unlocker: Send + Sync {
|
||||
) -> std::result::Result<Unlocked, UnlockError>;
|
||||
}
|
||||
|
||||
/// Name of the firmware unlocker that supports this drive (for drive-info "is
|
||||
/// this drive supported?" display), or `None`. A pure profile lookup — does NOT
|
||||
/// touch the drive or unlock anything.
|
||||
pub fn firmware_unlocker_name(drive_id: &DriveId) -> Option<&'static str> {
|
||||
/// Name of the unlocker that claims this drive by identity (for drive-info "is
|
||||
/// this drive supported?" display), or `None`. A pure lookup — does NOT touch
|
||||
/// the drive or unlock anything. Only the identity-keyed (drive-prep) unlocker
|
||||
/// can answer from a `DriveId` alone; the disc-kind-keyed unlockers (AACS / CSS)
|
||||
/// don't claim a drive sight-unseen, so they never match here.
|
||||
pub fn unlocker_name(drive_id: &DriveId) -> Option<&'static str> {
|
||||
ld::firmware_name(drive_id)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user