tools/ public with a local config, private tools to .tth/tools/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-13 16:03:03 +01:00
1 parent b7b397b9b1
commit 845a228209
27 files changed
+5312 -4

No files matched your search

Executable
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Board names -> USB serial numbers, for the Python tools.
A thin view of the local config (tools/mctools_config.py,
~/.config/meshcore-tools/config.ini): the tools refer to boards by name, and
`/dev/serial/by-id` is matched on the serial number -- a ttyACM number
changes with every replug and would point a console at a DIFFERENT board.
There used to be a table here, and a copy of it in five other places (the
shell flashers, the sniffer, the console and a hook). One board reflashed,
the copies drifted, and a stale entry aimed a console at the wrong board.
Now there is one file, outside the repo.
"""
from mctools_config import boards, serial_for # noqa: F401 (re-exported)
# name -> serial, only boards that have one (a BLE-only node has none)
FLEET = {n: b["serial"] for n, b in boards().items() if b.get("serial")}
# the same keyed by each alias too (mesh_sniffer takes `--board 0`)
FLEET_BARE = dict(FLEET)
for _b in boards().values():
for _a in (x.strip() for x in _b.get("aliases", "").split(",")):
if _a and _b.get("serial"):
FLEET_BARE[_a] = _b["serial"]