Refactor error types: replace generic AacsError/DiscError with typed variants

- Split AacsError { detail } into 13 specific error variants (AacsCertShort,
  AacsAgidAlloc, AacsCertRejected, etc.) with unique error codes E7001-E7012
- Split DiscError { detail } into 7 specific variants (DiscRead, MplsParse,
  ClpiParse, UdfNotFound, DiscNoTitles, DiscTitleRange, DiscNoExtents)
- Add WriteError (E5001), KeydbLoad (E8005), MuxLookahead (E9000), MuxWrite (E9001)
- Add OpenDisc API for single-call open+scan+rip workflow
- Remove all English text from error Display impl (code-only output)
- Normalize doc comments to use -- instead of em dash for ASCII consistency
This commit is contained in:
MattJackson
2026-04-10 08:19:28 -07:00
parent 9241d767ee
commit 074f21ba58
10 changed files with 302 additions and 202 deletions
+3 -10
View File
@@ -113,12 +113,7 @@ impl Mt1959 {
if response.len() >= FIRMWARE_ACTIVE_OFFSET + 4
&& response[FIRMWARE_ACTIVE_OFFSET..FIRMWARE_ACTIVE_OFFSET + 4] != FIRMWARE_ACTIVE_SIG {
return Err(Error::UnlockFailed {
detail: format!(
"mode not active: {:02x}{:02x}{:02x}{:02x}",
response[12], response[13], response[14], response[15]
),
});
return Err(Error::UnlockFailed);
}
self.unlocked = true;
@@ -148,9 +143,7 @@ impl Mt1959 {
match self.do_unlock(scsi) {
Ok(_) => { unlocked = true; break; }
Err(Error::SignatureMismatch { .. }) => {
return Err(Error::UnlockFailed {
detail: "signature mismatch — wrong profile for this drive".into(),
});
return Err(Error::UnlockFailed);
}
Err(_) => {
let ok = if self.mode == MODE_A {
@@ -163,7 +156,7 @@ impl Mt1959 {
}
}
if !unlocked {
return Err(Error::UnlockFailed { detail: "failed after 6 attempts".into() });
return Err(Error::UnlockFailed);
}
Ok(())
}
+1 -3
View File
@@ -12,9 +12,7 @@ const VERIFY_BUFFER_ID: u8 = 0x45;
pub(super) fn load_firmware(mt: &mut Mt1959, scsi: &mut dyn ScsiTransport) -> Result<()> {
let firmware = &mt.profile.firmware;
if firmware.is_empty() {
return Err(crate::error::Error::UnlockFailed {
detail: "no firmware in profile".into(),
});
return Err(crate::error::Error::UnlockFailed);
}
// Upload firmware via WRITE_BUFFER
+1 -3
View File
@@ -16,9 +16,7 @@ const VENDOR_VERIFY: [u8; 10] = [0xF1, 0x01, 0x02, 0x00, 0x0D, 0x30, 0x01, 0xF3,
pub(super) fn load_firmware(mt: &mut Mt1959, scsi: &mut dyn ScsiTransport) -> Result<()> {
let firmware = &mt.profile.firmware;
if firmware.is_empty() {
return Err(crate::error::Error::UnlockFailed {
detail: "no firmware in profile".into(),
});
return Err(crate::error::Error::UnlockFailed);
}
// Step 1: Upload firmware via MODE SELECT