From d76326729cee8a0c75f95d6fc08a60fa81694088 Mon Sep 17 00:00:00 2001 From: lyrathorpe Date: Mon, 6 Jul 2026 17:51:18 +0100 Subject: [PATCH] docs(inventory): note blocking loop + raw-format diagnostic --- code/inventory/README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/code/inventory/README.md b/code/inventory/README.md index aab5f5c..835674d 100644 --- a/code/inventory/README.md +++ b/code/inventory/README.md @@ -31,8 +31,15 @@ result as an RS232 stream, so there is no special barcode driver call: the app opens the serial port and reads it. The scanner is on the top internal slot, which is port **D**, so the device is `TTY:D` (`bcode.c`). -The scan loop is asynchronous: it waits on the scanner and the keyboard at the -same time, so a scan is processed immediately and Esc quits at any point. +The scan loop is blocking: it reads the scanner and prints each barcode; you +exit via the System screen. (An asynchronous scan-or-Esc loop was tried but +panicked the Window Server: on SIBO the keyboard is event-driven through the +window server, not a raw `CON:` byte read, and a proper async loop needs the +Window Server event API, whose reference manual is not in this repo's `docs/`.) + +This Phase 1 build also prints the byte length of each decoded barcode, so the +exact format the scanner emits for a UPC can be confirmed before Phase 2 uses +it as a database key. ## Things to confirm on the device @@ -44,8 +51,7 @@ the SDK docs but may need adjusting once you build and test: `p_iow(chan, P_FSET, &config)` (E_CONFIG, `p_config.h`) after opening. - **Terminator.** `BCODE_TERM` in `bcode.h` is set to CR (`0x0D`), the common case. Change it if your scanner suffixes LF or something else. -- **Esc key code.** `KEY_ESC` in `scan.c` is `27`; adjust if the console - delivers a different code. -- **`CON:` async read.** Phase 1 reads single keystrokes asynchronously from - `CON:`; if that behaves differently on your unit, the keyboard handling in - `scan.c` is where to look. +- **Raw scan format.** The build prints `len=NN [text]` per scan. Confirm + whether a UPC arrives as exactly 12 digits or with extra characters (a + leading zero / EAN-13, or a symbology prefix); Phase 2 normalises to the + database key based on this.