From 397ce274e48424bda33f1b54b670f5f91fcdc2ed Mon Sep 17 00:00:00 2001 From: lyrathorpe Date: Mon, 6 Jul 2026 18:46:37 +0100 Subject: [PATCH] diag(inventory): stream one byte per read (tmask=0 full-count read was blocking) --- code/inventory/scan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code/inventory/scan.c b/code/inventory/scan.c index f6ccba1..d86fa9e 100644 --- a/code/inventory/scan.c +++ b/code/inventory/scan.c @@ -56,20 +56,20 @@ GLDEF_C INT main(VOID) p_printf("\nScan a barcode. System screen to exit.\n\n"); + /* Read ONE byte per call: with tmask=0 a multi-byte P_FREAD waits for the + full requested count and would block on a short scan. Streaming single + bytes returns each character as it arrives, whatever the terminator. */ for (;;) { - n = p_read(chan, buf, sizeof(buf)); + n = p_read(chan, buf, 1); if (n < 0) { - p_printf("read err %d\n", n); + p_printf("", n); continue; } if (n == 0) continue; - p_printf("n=%d:", n); - for (i = 0; i < n; i++) - p_printf(" %d", buf[i]); - p_printf(" \""); - for (i = 0; i < n; i++) - p_putch(buf[i] >= ' ' ? buf[i] : '.'); - p_printf("\"\n"); + i = buf[0]; + p_printf(" %d", i); + if (i == 13 || i == 10) + p_printf(" \n"); } }