cbf510e70ebd0dce223e77c69c23536c672530a1
Error codes: 1000-1001: device errors (not found, permission) 2000-2002: profile errors (unsupported, not found, parse) 3000-3003: unlock errors (failed, signature, not unlocked, not calibrated) 4000-4001: SCSI errors (command failed, timeout) 5000: I/O errors All errors carry structured data (vendor_id, opcode, etc). Applications format their own user-facing messages. Library returns code + data, never English text.
libfreemkv
Open source raw disc access library for UHD Blu-ray optical drives.
Enables direct sector reading on compatible drives for UHD Blu-ray archival, backup, and media extraction. Ships with community-contributed drive profiles — no proprietary data files needed at runtime.
Features
- Drive identification — SCSI INQUIRY + GET CONFIGURATION for automatic profile matching
- Raw read mode — activate enhanced read mode on supported drives
- Speed calibration — optimal read speed per disc region
- Raw sector reading — direct READ(10) access to disc sectors
- Drive profiles — per-drive SCSI command data, shipped as JSON files
- Community-driven — submit new drive profiles via
freemkv-info
Supported Drives
Currently supports 280+ LG, ASUS, and HP optical drive firmware versions across the MediaTek MT1959 chipset family. Pioneer Renesas support is in progress.
See profiles/ for the full list.
Installation
cargo install libfreemkv
Or add to your Cargo.toml:
[dependencies]
libfreemkv = "0.1"
Quick Start
As a library
use libfreemkv::DriveSession;
use std::path::Path;
let mut session = DriveSession::open(
Path::new("/dev/sr0"),
Path::new("profiles/"),
)?;
session.enable()?; // activate raw read mode
session.calibrate()?; // optimize read speed
let mut buf = vec![0u8; 2048];
session.read_sectors(0, 1, &mut buf)?;
freemkv-info
Identify your drive and check compatibility:
$ freemkv-info /dev/sr0
Drive: HL-DT-ST BD-RE BU40N 1.03
Chipset: MT1959
Raw Read: Supported
Profile: Found (mt1959_a)
$ freemkv-info /dev/sr0 --raw
# Dumps full INQUIRY and GET CONFIGURATION responses as hex
# Useful for contributing profiles for unsupported drives
freemkv-test
Verify raw read mode works:
$ freemkv-test /dev/sr0
Enabling raw read mode... OK
Calibrating speed... OK (42 speed zones)
Reading sector 0... OK (2048 bytes)
Reading sector 1000... OK (2048 bytes)
All checks passed.
Contributing Drive Profiles
If your drive isn't supported, you can help:
- Run
freemkv-info /dev/sr0 --raw > my_drive.txt - Open an issue or PR with the output
- We'll generate a profile from your drive data
This is especially needed for Pioneer drives.
Architecture
DriveSession
├── ScsiTransport — SG_IO (Linux) / IOKit (macOS)
├── DriveProfile — per-drive JSON data
└── Platform — per-chipset unlock + read logic
├── Mt1959 — LG/ASUS MediaTek drives
└── Pioneer — Pioneer Renesas drives (WIP)
The library implements 10 drive commands per platform:
| Command | Purpose |
|---|---|
| enable | Activate raw read mode |
| read_config | Read drive configuration |
| read_register | Read hardware registers |
| calibrate | Build speed optimization table |
| keepalive | Session keepalive |
| status | Read mode status and features |
| probe | Generic drive query |
| read_sectors | Read raw disc sectors |
| read_disc_structure | Read disc metadata |
| timing | Timing calibration |
License
AGPL-3.0-only
Languages
Rust
99.6%
C
0.3%
Shell
0.1%