Firmware catalog
The firmware catalog describes where firmware bytes come from; the
device registry (see device-profiles.md) describes
what a device looks like. They're deliberately separate, and linked only
by model_id.
One tree, maintained in this repository only
The whole catalog is src/scooterflasher/catalog/entries/: one YAML file
per scooter model, grouped into brand folders, shipped inside the package.
src/scooterflasher/catalog/entries/
xiaomi/
m365.yaml
pro-2.yaml
ninebot/
g2.yaml
There is no user-configurable catalog source — no settings.json entry,
no "add a local directory", nothing. The only way firmware gets into this
catalog is a pull request adding or editing a file under entries/. A
firmware you have locally that isn't cataloged here is used via
scooterflasher flash --write <region>=<path-to-file> (or the interactive
wizard's "→ local file..." option) — which is never written to any file
for reuse; you pass the path again each time.
Populated from scooterhacking/firmware —
13 models, 143 firmware versions as of this writing (scooterflasher catalogs list for the current count). See
src/scooterflasher/catalog/entries/README.md for exactly which models
are covered, which aren't (and why), and the provenance/license caveat
for that upstream source.
Model file schema
model_id: xiaomi-m365 # must match registry/profiles/xiaomi-m365.yaml
name: Xiaomi Mi Electric Scooter (M365)
versions:
- kind: drv # drv | ble | bms
version: "1.4.2" # semantic version
urls:
- https://github.com/scooterhacking/firmware/raw/main/m365/drv-1.4.2.bin
- https://my-personal-mirror.example.com/m365-drv-1.4.2.bin
sha256: "…64 lowercase hex chars… (optional, but verified when present)"
- kind: ble
version: "2.1.0"
urls:
- https://example.com/m365-ble-2.1.0.bin
kindis which board the firmware is for:drv(the ESC/motor controller — the original's own term; its bootloader files were literally namedmi_DRV.bin/nb_DRV.bin),ble(the dashboard), orbms(battery management system).drv/blemap onto a profile's<model_id>-esc/<model_id>-bletargets;bmshas no registry target yet, sobms-kind entries are cataloged for completeness but can't currently be selected throughplan/flash/verify's target-based--artifactflow or the interactive wizard.urlsis a list, not a single URL — one firmware version can have several mirrors (e.g. a primary GitHub source plus a personal backup), tried in order on download; the first one that both responds and matchessha256(when given) wins.sha256is optional but strongly recommended: when present, a downloaded file that doesn't match it is rejected and the next mirror is tried instead of ever reaching the flash cache.- One
(kind, version)pair may not repeat within a model's file, and no two files may declare the samemodel_id; both are enforced at load time (DuplicateModelError/parse validation), not just documented.
Full schema notes live in src/scooterflasher/catalog/entries/README.md
next to the tree itself.
Using the catalog
scooterflasher catalogs list # every model + version + mirror
scooterflasher catalogs validate # parse/schema-check only, no download
scooterflasher catalogs download xiaomi-m365 drv 1.4.2 # explicit download into the local cache
catalogs list renders each mirror URL with
scooterflasher.catalog.sources.format_source_label: GitHub/GitLab URLs
show as Github.com (owner/repo) / Gitlab.com (owner/repo); anything
else shows as its capitalized domain (e.g. Scooterhacking.org).
To actually flash a cataloged firmware:
scooterflasher flash --device xiaomi-m365 --target xiaomi-m365-esc \
--artifact firmware=drv:1.4.2 --adapter stlink --confirm ...
--artifact <region>=<kind>:<version> resolves against the current
profile's model_id automatically — downloading it (if not already
cached) is exactly what passing --artifact does, no separate
catalogs download step required. The interactive wizard's firmware
picker (used when --write/--artifact are omitted in a real terminal)
does the same thing on selection.
Offline behavior
Loading the catalog (catalogs list, catalogs validate, plan, and
resolving --write writes) never makes a network request — it only reads
the bundled YAML tree. The only function in the codebase allowed to
touch the network is scooterflasher.catalog.transport.http_get, called
only from CatalogService.download(), itself only reached via an explicit
catalogs download, an explicit --artifact flag, or an explicit pick in
the interactive wizard — never as a side effect of listing or planning.
http_get enforces a timeout, a bounded number of retries with backoff, a
Content-Length pre-check, and a hard cap on bytes actually read.
CatalogService.download() re-verifies sha256 (when the catalog entry
has one) after transfer and only promotes the file into the cache via
write-to-temp-then-atomic-rename; a downloaded file is cached forever
under the platform cache directory (see scooterflasher doctor), so a
version is only ever fetched once.
Provenance
The original ScooterFlasher's own bundled bootloader/firmware binaries have no
documented per-file source, version, or license — see
migration-from-scooterflasher.md for what the audit found
(e.g. mi_BLE.bin and nb_BLE.bin are byte-identical, undocumented
blobs). Better ScooterFlasher never redistributed those; instead this catalog links to
scooterhacking/firmware,
whose own files also carry no license declaration on GitHub — every
urls entry is a link to that upstream repository's raw content (never a
copy stored in this repository), and every sha256 was computed locally
from the actual downloaded bytes at import time. Adding a new entry means
a pull request with real, working mirror URLs (and ideally a sha256) —
not an assumption carried over from the original or from scooterhacking.