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.
  • DriveClass — the update dialect a drive speaks (Identity::class).
  • 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.
  • image also enables update: an update prepared against the installed firmware, refused across chips and hardware families. With drive, the receiver-bound receiver::PreparedUpdate::flash runs it.
  • 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.
envelope
Validated input framing, independent of the running receiver’s wire format.
image
Firmware image analysis: chip detection, the hardware family 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.
receiver
Read-only detection of the active MediaTek update receiver.
recovery
Explicit recovery without installed-firmware, model, family or backup policy. Requires drive, image and enc. Identification and preparation are read-only; the caller owns consent and write authorization.
sense
Sense-data parsing and classification.
update
An update prepared against the drive’s installed firmware.

Structs§

Identity
A drive’s identity: the standard INQUIRY response, the boot banner at layout::BANNER and the identity descriptor at layout::DESCRIPTOR.
UnknownChip
Chip::label did not name a chip.

Enums§

Chip
A MediaTek optical controller generation.
DriveClass
The update dialect a drive speaks, chosen by Identity::class.

Constants§

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

Traits§

CodedError
A typed error with a stable, namespaced identifier.