From 4f2a390c9225a142fc15aa2e86f5ac4f3155fdf3 Mon Sep 17 00:00:00 2001 From: Patryk Kubiak Date: Mon, 12 Oct 2026 16:37:11 +0200 Subject: [PATCH] ymodem_send: report the files the device did not write The receiver leaves out a file it cannot open (in use - the MP3 being played) and goes on with the batch (dmell's ymodem). The script shows them and fails, so that a build target does not pass over them. Co-Authored-By: Claude Opus 5.5 --- scripts/ymodem_send.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/ymodem_send.py b/scripts/ymodem_send.py index e6a4600..c514781 100755 --- a/scripts/ymodem_send.py +++ b/scripts/ymodem_send.py @@ -304,8 +304,14 @@ def progress(name, sent, size): said = link.drain(0.5).decode(errors='replace').strip() log(f'{len(files)} file(s), {total} bytes in {seconds:.1f} s ({total / seconds / 1024:.1f} KiB/s)' + (f', {link.retries} block(s) sent again' if link.retries else '')) - if said: - log(f'device: {said.splitlines()[0] if said.startswith("ymodem") else said}') + answer = next((l.strip() for l in said.splitlines() if l.strip().startswith('ymodem:')), said) + if answer: + log(f'device: {answer}') + if 'not written' in answer: + # (files the device had open - played, shown: received, left as they were) + print(f'ymodem_send: some files were not written - in use on the device? Stop what uses them ' + f'(e.g. `service stop carhmi`) and send them again: {answer.split(": ", 2)[-1]}', file=sys.stderr) + return 1 return 0 except Failure as e: try: