libfreemkv: add DiscSession (drive open/bring-up hoist, step 1)

New src/session.rs providing DiscSession, DeviceTarget, and KeySpec,
re-exported from lib.rs. DiscSession::open runs the drive open +
advisory wait_ready/init/probe_disc bring-up (owning the Drive by
value); identify()/scan() are split so consumers keep their own
UI/TMDB sequencing. KeySpec carries consumer-built credentials +
key_sources which scan() forwards into ScanOptions without clobbering
caller-set fields (the library derives no certs and reads no keydb).
Unit tests cover the KeySpec->ScanOptions forwarding.
This commit is contained in:
Matthew Jackson
2026-07-23 23:37:20 -07:00
parent b9568242df
commit 7ed798e386
2 changed files with 299 additions and 0 deletions
+9
View File
@@ -125,6 +125,7 @@ pub(crate) mod platform;
pub mod progress;
pub mod scsi;
pub mod sector;
pub mod session;
pub(crate) mod speed;
pub(crate) mod udf;
pub(crate) mod unlock_bridge;
@@ -139,6 +140,14 @@ pub use drive::capture::{
};
pub use drive::{Drive, DriveStatus, find_drive};
// ─── Disc session (drive open + SCSI bring-up hoist) ─────────────────────────
//
// One entry point that opens a drive and brings the transport up, so consumers
// stop hand-rolling `open → wait_ready → init → probe_disc → identify → scan`.
// Owns the `Drive` by value; forwards consumer-built key material into
// `ScanOptions` (the library derives no certs — see `KeySpec`).
pub use session::{DeviceTarget, DiscSession, KeySpec};
// ─── Errors ─────────────────────────────────────────────────────────────────
//
// All fallible APIs return `Result<T, Error>`. `Error` is a typed enum with a