Skip to content

Repository files navigation

FirmwareKit.Comm.EDL

License: MIT

A modern .NET library and CLI for communicating with Qualcomm devices in EDL (Emergency Download Mode / 9008). Implements the Sahara and Firehose protocols over USB, Serial, and HS-UART transports, and is part of the FirmwareKit ecosystem.

Warning

Flashing firmware can permanently brick a device. This tool is intended for developers, repair technicians, and experienced users. Use at your own risk.

Features

  • Sahara protocol — handshake, image transfer, memory debug dump/read, mode switch, HELLO re-negotiation, Kickstart mode for flashless-boot devices.
  • Firehose protocol — XML and JSON command builders, streaming response parser, chained digest table (VIP) support, heartbeat-aware erase, wipe and UFS reset, read-back verification, per-packet hashing.
  • TransportsIEdlTransport implementations for USB (via FirmwareKit.Comm), Serial (System.IO.Ports), HS-UART, and HDLC framing.
  • Firmware bundles — parsers for Qualcomm rawprogram0.xml / patch0.xml / UFS provisioning, plus a FlashBundleOrchestrator for multi-image flashing.
  • GPT support — partition table read/fix via the FirmwareKit.PartitionTable package.
  • AOT-friendlyIsAotCompatible, no reflection-heavy code.
  • Targets netstandard2.0, net8.0, and net10.0.

Packages

Package Description
FirmwareKit.Comm.EDL Main library — EdlDriver facade: state machine, events, flash/read/erase/memory/patch/GPT operations.
FirmwareKit.Comm.EDL.Core Shared data model, error codes, events, security helpers, GPT wrapper.
FirmwareKit.Comm.EDL.Backend IEdlTransport abstractions and USB / Serial / HS-UART / HDLC transport implementations.
FirmwareKit.Comm.EDL.Firehose Firehose protocol: XML/JSON command builders and response parsers.
FirmwareKit.Comm.EDL.Sahara Sahara protocol: packets, ELF image loader, state machine.
FirmwareKit.Comm.EDL.FirmwareBundle rawprogram/patch/UFS-provision parsers and flashing orchestrator.
FirmwareKit.Comm.EDL.Hsuart HS-UART low-level codecs: COBS, CRC16, HDLC framing, packet ids.

| FirmwareKit.Comm.EDL.VIP | qdl-compatible Verified Image Programming (VIP) digest table generator for Secure Boot production flashing. |

Quick start — CLI

# Detect devices in EDL (9008) mode
edl detect

# Wait up to 30 s for a device to appear, then list it
edl detect --wait 30

# Flash a firmware image (firehose programmer required)
edl flash boot.img --programmer prog_firehose_ddr.elf

# Read a partition
edl read boot.img --programmer prog_firehose_ddr.elf

# Erase a partition
edl erase --programmer prog_firehose_ddr.elf

Run edl --help for the full command and option reference.

Quick start — library

using FirmwareKit.Comm.EDL;

var driver = new EdlDriver();

// Optional tuning (makes tests/harness runs faster)
driver.SetResponseTimeoutSeconds(10);
driver.SetSectorSize(4096);

// Detect a device in EDL mode
var devices = EdlDriver.DetectDevices();
if (devices.Count == 0) return;

// Boot the firehose programmer, then configure
await using var programmer = File.OpenRead("prog_firehose_ddr.elf");
await driver.ConnectAsync();
await driver.SaharaHandshakeAsync(programmer);
await driver.ConfigureFirehoseAsync();

// Flash a partition
await using var image = File.OpenRead("boot.img");
await driver.FlashPartitionAsync("boot", image);

See each package's own README and docs/architecture.md for the layered design.

Requirements

  • .NET SDK 10 (the solution uses the new .slnx format; older SDKs/VS cannot open it).
  • For USB transport: a device in EDL mode (VID 0x05C6, PIDs 9008/9006/900E/9307).

Building and testing

# Quick build (skip nupkg packing for speed)
dotnet build FirmwareKit.Comm.EDL.slnx -p:GeneratePackageOnBuild=false

# Run tests (xunit v3, net10.0 — no hardware required, uses a mock transport)
dotnet test FirmwareKit.Comm.EDL.Tests

License

MIT — see LICENSE. Copyright (c) 2026 Uotan-Dev.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages