Matthew Jackson 47d5d1e0b9 Rename to the generic Unlocker contract; add set_max_read_speed
Track libfreemkv's finalized 3-capability Unlocker trait:

  - unlock(...)   -> unlock_drive(...)
  - read_vid(...) -> read_volume_id(...)
  - add set_max_read_speed(...)

set_max_read_speed issues the matched profile's set_speed_max_cdb
(0xBB SET CD SPEED, to max) over the raw transport; a profile without a
set_speed_max_cdb (or no matching profile) is a no-op so the drive stays at
its current speed. read_disc_keys_cdb is left untouched — inert profile data,
never issued, no trait method.

README: document the 3-method contract, the delete-to-comply fallback, and the
#2-only boundary (freemkv uploads RAM microcode to an already-bootloader-flashed
drive; the permanent bootloader flash #1 is the owner's one-time manual step,
never automated). Left a marked MakeMKV attribution placeholder for the
maintainer to author.

Tests: renamed read_vid tests; added set_max_read_speed tests (issues the CDB
when present, no-op when the profile carries none).
2026-06-22 11:05:30 -07:00

freemkv-unlock-ld

The LibreDrive unlocker plugin for libfreemkv.

libfreemkv ships only the Unlocker trait + registry and stays firmware-clean. This crate owns how MediaTek MT1959 drives are firmware-unlocked: the bundled drive-profile database (profiles.json), the firmware blobs, the WRITE_BUFFER / MODE SELECT upload, the unlock CDBs, and the variant-A / variant-B handshake logic.

Usage

Register the unlocker once at process start, before any rip:

libfreemkv::register_unlocker(Box::new(freemkv_unlock_ld::LibreDrive::new()));

That single line is the whole plug. Any drive whose identity matches a bundled profile is firmware-unlocked at drive-prep; everything else falls through to libfreemkv's host-certificate AACS handshake.

The Unlocker contract

This crate is the LibreDrive unlocker — an implementation of libfreemkv's Unlocker trait. The trait is a 3-method capability contract:

  • unlock_drive — put the drive into extended-access mode. The one required capability.
  • read_volume_id — read the disc Volume ID directly, bypassing the AACS cert handshake. None → libfreemkv falls back to the cert-based read. No-op default.
  • set_max_read_speed — raise the drive to its maximum read speed. No-op default.

libfreemkv's AACS layer is the always-present baseline; it uses an unlocker's capabilities when one matches, and does the full cert handshake when none do. Remove this crate and libfreemkv still compiles and rips — every capability falls back to the OEM/baseline path.

Scope: RAM microcode only (#2), never the bootloader flash (#1)

freemkv uploads the RAM microcode to an already-bootloader-flashed drive. The permanent bootloader flash (#1) is the drive owner's one-time manual step; it is never automated by freemkv. This crate only performs the non-persistent #2 step — the microcode lives in RAM and is gone on power cycle.

S
Description
firmware unlock crate — build dep for kdb (libfreemkv git-deps it)
Readme MIT
463 KiB
Languages
Rust 100%