Files
sibo-playground/code/inventory/scan.c
T

40 lines
1.1 KiB
C
Raw Normal View History

/*
* scan.c - Phase 1 barcode diagnostic: keyboard / scan-key route.
*
* A working on-device demo triggers the laser from the keyboard scan key, so
* the system arms the scanner and delivers the decode via the scan-key path -
* not via an app-opened TTY:D or BAR: channel (both of which gave us nothing).
* This build opens NOTHING and simply reads the keyboard, echoing every key
* code. If the decoded barcode is injected as keystrokes (a "wedge"), it will
* appear here.
*
* Test order:
* 1. Press normal keys ('1' = 49, '2' = 50, ...) to confirm the read works.
* 2. Press the scan key and scan a barcode - watch for the digits.
* Esc (27) quits.
*/
#include <plib.h>
GLDEF_C INT main(VOID)
{
INT c, cnt;
p_printf("Keyboard/scan-key test.\n");
p_printf("Press keys; press the scan key and scan a barcode.\n");
p_printf("Esc (27) quits.\n\n");
cnt = 0;
for (;;) {
c = p_getch();
cnt++;
p_printf(" %d", c);
if (c == 13 || c == 10)
p_printf(" <EOL>\n");
if (c == 27)
break;
}
p_printf("\n%d keys read.\n", cnt);
return 0;
}