Skip to main content

Crate mediatek_optical

Crate mediatek_optical 

Source
Expand description

MediaTek MT1959 / MT1939 optical drive (BD/DVD) protocol: command encoding, identity decoding, firmware image analysis and OEM image reconstruction.

The crate root is no_std, allocation-free and dependency-free:

  • cdb — the command descriptor blocks, as byte constructors.
  • Identity — the decoded INQUIRY, boot banner and identity descriptor.
  • Chip — which controller generation a drive or image belongs to.
  • layout — the fixed 2 MiB image geometry and the drive-written regions.
  • sense — sense-data parsing and classification of flash faults.

Optional features add:

  • drive — drive: the command sequences (identify, memory read, flash session) over a caller-supplied drive::Transport.
  • image — image: chip detection from image bytes and the AES-CMAC integrity table (image::cmac). Uses std.
  • enc — enc: the AES-128-ECB transport envelope.
  • oem — oem: rebuild the flashable OEM image from a drive read, with the provenance of every substituted byte. Implies image.
  • std — links the standard library (implied by image).

§Drive memory

READ BUFFER mode 6 exposes the 2 MiB flash at file offsets, with one exception: the boot page 0x0..0x400 reads back as the image’s own page at layout::BOOT_MIRROR instead of its stored form. The drive also rewrites the regions in layout::DRIVE_WRITTEN at runtime (revocation lists, settings, calibration), so a read is never byte-identical to the image that was flashed. oem::rebuild undoes both.

Modules§

cdb
Command descriptor blocks, as byte constructors.
drive
Command sequences over a caller-supplied Transport: identify, memory read and the flash session.
enc
The AES-128-ECB enc transport envelope.
image
Firmware image analysis: chip detection and the AES-CMAC integrity table.
layout
The fixed geometry of an MT19xx flash image.
oem
Rebuild the flashable OEM image from a drive read.
sense
Sense-data parsing and classification.

Structs§

Identity
A drive’s identity: the standard INQUIRY response, the boot banner at layout::BANNER and the identity descriptor at layout::DESCRIPTOR.

Enums§

Chip
A MediaTek optical controller generation.

Constants§

INQUIRY_LEN
Length of a standard INQUIRY response header, in bytes.