From e1ffdf8fdd59d57893c6b878130692e1747e22db Mon Sep 17 00:00:00 2001 From: QIU SHENGMING Date: Thu, 1 Oct 2026 15:23:27 +0800 Subject: [PATCH] panel_dump: say why QMP is unreachable, and exit 2 for it QMP takes a single client and the web UI holds it for its whole lifetime, so this is the normal outcome while the page is open rather than a broken emulator. Verified against a private instance: 128x64, 1819 pixels lit, 64 rows of ASCII. --- tools/panel_dump.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/panel_dump.py b/tools/panel_dump.py index 5897805..0a96255 100644 --- a/tools/panel_dump.py +++ b/tools/panel_dump.py @@ -36,7 +36,18 @@ def main(argv=None): from uvk5_qmp import QmpClient # The frame addresses are unused on this path: the controller has its own memory. - grab = uvk5_lcd.FrameGrabber(QmpClient(args.qmp, timeout=20), 0, 0) + try: + client = QmpClient(args.qmp, timeout=20) + except Exception as exc: + # QMP takes one client, and the web UI holds it for its whole lifetime -- so this + # is the normal outcome while the page is open, not a broken emulator. + print('cannot reach QMP at %s: %s' % (args.qmp, str(exc).splitlines()[0]), file=sys.stderr) + print('if the web UI is running it is holding the one QMP client; stop it, or use', + file=sys.stderr) + print('--qmp with the endpoint of an emulator started by tools/run.sh instead.', + file=sys.stderr) + return 2 + grab = uvk5_lcd.FrameGrabber(client, 0, 0) pixels = grab.panel_pixels() if args.mapping in ("mirror-cols", "both"): pixels = [list(reversed(row)) for row in pixels]