Clean pipeline: one open, one init, no double-init

- Removed open_unlocked() — open() is the only entry
- Removed redundant init() call from open_title()
- init() called once in open(), handles everything
- Each function does one thing: open→init→scan→read
This commit is contained in:
MattJackson
2026-04-08 21:35:48 -07:00
parent ecc6cd9f6b
commit 0b19154bd3
3 changed files with 20 additions and 27 deletions
+4 -14
View File
@@ -30,10 +30,11 @@ pub struct DriveSession {
}
impl DriveSession {
/// Open a drive — identify, wait for disc, and unlock for raw reads.
///
/// This is the standard entry point. After `open()`, the drive is
/// ready for scanning and content reads.
/// This is the only entry point. After `open()`, the drive is
/// ready for scanning and content reads. init() handles everything:
/// unlock, firmware upload if needed, calibration, registers.
/// Called once per session. Non-fatal if init fails (BD works without it).
pub fn open(device: &Path) -> Result<Self> {
let mut session = Self::open_no_unlock(device)?;
session.wait_ready()?;
@@ -41,17 +42,6 @@ impl DriveSession {
Ok(session)
}
/// Open a drive and immediately init for raw reads.
///
/// Use this when you need raw disc access without AACS (e.g. capture,
/// sector dumps). Skips AACS authentication — cannot be done after init.
pub fn open_unlocked(device: &Path) -> Result<Self> {
let mut session = Self::open_no_unlock(device)?;
session.wait_ready()?;
let _ = session.init();
Ok(session)
}
/// Open a drive — identify only, no wait, no unlock.
///
/// Low-level entry point. Caller is responsible for wait_ready()