feat(inventory): Phase 1 - scan and validate UPC barcodes #1

Open
lyrathorpe wants to merge 54 commits from feat/inventory-phase1-scan into main
Showing only changes of commit 397ce274e4 - Show all commits
+9 -9
View File
@@ -56,20 +56,20 @@ GLDEF_C INT main(VOID)
p_printf("\nScan a barcode. System screen to exit.\n\n"); 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 (;;) { for (;;) {
n = p_read(chan, buf, sizeof(buf)); n = p_read(chan, buf, 1);
if (n < 0) { if (n < 0) {
p_printf("read err %d\n", n); p_printf("<err %d>", n);
continue; continue;
} }
if (n == 0) if (n == 0)
continue; continue;
p_printf("n=%d:", n); i = buf[0];
for (i = 0; i < n; i++) p_printf(" %d", i);
p_printf(" %d", buf[i]); if (i == 13 || i == 10)
p_printf(" \""); p_printf(" <EOL>\n");
for (i = 0; i < n; i++)
p_putch(buf[i] >= ' ' ? buf[i] : '.');
p_printf("\"\n");
} }
} }