# abdo10dz/spdclient architecture

> Architecture diagram of the GitHub repository abdo10dz/spdclient, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdo10dz/spdclient
- Repository: https://github.com/abdo10dz/spdclient

## Overview

SPDClient is a command-line tool for interacting with Spreadtrum/Unisoc BootROM devices over serial. Its main workflow connects to a device, loads FDL bootloaders when needed, and performs raw-address or named-partition operations; it also supports backups, device information, partition listing, and PAC loader extraction. The implementation is concentrated in spd.py. Several capabilities are documented in the README but their implementation details were not included in the excerpt, so those edges rely on the README rather than sampled call sites.

Main entry points: [`spd.py`](https://github.com/abdo10dz/spdclient/blob/main/spd.py) (Command Dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command Line"]
  node_cli["Command Dispatcher<br/>[spd.py]"]
end

subgraph group_device["Device Protocol"]
  node_serial["Serial Connection<br/>[spd.py]"]
  node_protocol["BootROM Commands<br/>[spd.py]"]
  node_fdl["FDL Loading<br/>[spd.py]"]
  node_deviceinfo["Device Information<br/>[spd.py]"]
  node_multi["Multi-device Management<br/>[spd.py]"]
end

subgraph group_flash["Flash Operations"]
  node_raw["Raw Flash I/O<br/>[spd.py]"]
  node_partitions["Partition Operations<br/>[spd.py]"]
  node_parttable["Partition Table Fallback<br/>[spd.py]"]
  node_backup["Backup and Restore<br/>[spd.py]"]
end

subgraph group_support["Utilities"]
  node_pac["PAC Extraction<br/>[spd.py]"]
  node_config["Profiles and Config<br/>[spd.py]"]
  node_journal["Operation Journal<br/>[spd.py]"]
  node_checksum["Checksums<br/>[spd.py]"]
  node_logging["Logging<br/>[spd.py]"]
end

node_user(("Operator"))
node_bootrom["BootROM Device"]
node_pacfile["PAC Firmware File"]

node_user -->|"runs commands"| node_cli
node_cli -->|"connects via"| node_serial
node_serial -->|"communicates with"| node_bootrom
node_cli -->|"dispatches commands"| node_protocol
node_protocol -->|"loads loaders"| node_fdl
node_protocol -->|"reads and writes"| node_raw
node_cli -->|"runs partition commands"| node_partitions
node_partitions -->|"falls back to"| node_parttable
node_cli -->|"runs backups"| node_backup
node_cli -->|"requests info"| node_deviceinfo
node_cli -->|"runs extraction"| node_pac
node_pacfile -->|"provides firmware"| node_pac
node_multi -->|"scans ports"| node_serial
node_journal -->|"tracks chunks"| node_raw

click node_cli "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_serial "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_protocol "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_fdl "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_raw "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_partitions "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_parttable "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_backup "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_deviceinfo "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_pac "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_multi "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_config "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_journal "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_checksum "https://github.com/abdo10dz/spdclient/blob/main/spd.py"
click node_logging "https://github.com/abdo10dz/spdclient/blob/main/spd.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli toneBlue
class node_serial,node_protocol,node_fdl,node_deviceinfo,node_multi toneAmber
class node_raw,node_partitions,node_parttable,node_backup toneMint
class node_pac,node_config,node_journal,node_checksum,node_logging toneRose
class node_user,node_bootrom,node_pacfile toneIndigo
```

## Components

### Command Line

- [Command Dispatcher](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`

### Device Protocol

- [Serial Connection](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [BootROM Commands](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [FDL Loading](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Device Information](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Multi-device Management](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`

### Flash Operations

- [Raw Flash I/O](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Partition Operations](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Partition Table Fallback](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Backup and Restore](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`

### Utilities

- [PAC Extraction](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Profiles and Config](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Operation Journal](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Checksums](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`
- [Logging](https://github.com/abdo10dz/spdclient/blob/main/spd.py): `spd.py`

### Other components

- **Operator**
- **BootROM Device**
- **PAC Firmware File**

## Connections

- Operator → Command Dispatcher: runs commands (evidence: `README.md`)
- Command Dispatcher → Serial Connection: connects via (evidence: `README.md`)
- Serial Connection → BootROM Device: communicates with (evidence: `README.md`)
- Command Dispatcher → BootROM Commands: dispatches commands (evidence: `README.md`)
- BootROM Commands → FDL Loading: loads loaders (evidence: `README.md`)
- BootROM Commands → Raw Flash I/O: reads and writes (evidence: `README.md`)
- Command Dispatcher → Partition Operations: runs partition commands (evidence: `README.md`)
- Partition Operations → Partition Table Fallback: falls back to (evidence: `README.md`)
- Command Dispatcher → Backup and Restore: runs backups (evidence: `README.md`)
- Command Dispatcher → Device Information: requests info (evidence: `README.md`)
- Command Dispatcher → PAC Extraction: runs extraction (evidence: `README.md`)
- PAC Firmware File → PAC Extraction: provides firmware (evidence: `README.md`)
- Multi-device Management → Serial Connection: scans ports (evidence: `spd.py`)
- Operation Journal → Raw Flash I/O: tracks chunks (evidence: `spd.py`)
