diag(inventory): try WL2:D (untried unit) then WL2:A; read + dump
This commit is contained in:
+29
-17
@@ -1,32 +1,45 @@
|
||||
/*
|
||||
* scan.c - Phase 1 barcode diagnostic: read the integral laser via WL2:A.
|
||||
* scan.c - Phase 1 barcode diagnostic: read the integral laser via WL2:D.
|
||||
*
|
||||
* demman reports the scanner's port as WL2:A (decoder "Symbol"), so the
|
||||
* integral MX laser is driven by the resident WL2 driver - not BAR:, not
|
||||
* TTY:D. WL2 is not documented in this SDK, so this opens WL2:A and dumps what
|
||||
* a read returns, to learn its format. It uses the barcode-style read
|
||||
* (p_iow(pcb, P_FREAD, buf), count typically in buf[0]) and prints the first
|
||||
* bytes both as decimal and as text.
|
||||
*
|
||||
* Press the scan key to trigger a scan while the read is waiting.
|
||||
* The MX ROM shows the scanner port is WL2 with units A and D, decoder
|
||||
* "Symbol2" (Workabout MX scanner). WL2:A returned -9 (in use); WL2:D (the
|
||||
* top-slot position, as TTY:D was) is untried. This opens WL2:D (falling back
|
||||
* to WL2:A), and if a channel opens, reads it barcode-style
|
||||
* (p_iow(pcb, P_FREAD, buf)) and dumps the bytes. Press the scan key to fire.
|
||||
*/
|
||||
#include <plib.h>
|
||||
|
||||
#define NU 2
|
||||
|
||||
GLDEF_C INT main(VOID)
|
||||
{
|
||||
VOID *chan;
|
||||
UBYTE buf[256];
|
||||
INT err, r, i, cnt;
|
||||
INT r, i, opened;
|
||||
UINT k;
|
||||
|
||||
err = p_open(&chan, "WL2:A", (UINT)-1);
|
||||
p_printf("open WL2:A: %d\n", err);
|
||||
if (err < 0) {
|
||||
p_printf("Press a key to exit.\n");
|
||||
static TEXT *names[NU] = { "WL2:D", "WL2:A" };
|
||||
INT results[NU];
|
||||
|
||||
opened = -1;
|
||||
for (k = 0; k < NU; k++) {
|
||||
r = p_open(&chan, names[k], (UINT)-1);
|
||||
results[k] = r;
|
||||
if (r >= 0 && opened < 0)
|
||||
opened = k;
|
||||
}
|
||||
|
||||
for (k = 0; k < NU; k++)
|
||||
p_printf("open %s: %d\n", names[k], results[k]);
|
||||
|
||||
if (opened < 0) {
|
||||
p_printf("\nNothing opened. Press a key.\n");
|
||||
p_getch();
|
||||
return 1;
|
||||
}
|
||||
|
||||
p_printf("Scan now (press the scan key). Dumping reads:\n\n");
|
||||
p_open(&chan, names[opened], (UINT)-1); /* reopen the winner */
|
||||
p_printf("\nOpened %s. Scan (press scan key). Dumping:\n\n", names[opened]);
|
||||
|
||||
for (;;) {
|
||||
r = p_iow(chan, P_FREAD, buf);
|
||||
@@ -34,8 +47,7 @@ GLDEF_C INT main(VOID)
|
||||
p_printf("read status %d\n", r);
|
||||
continue;
|
||||
}
|
||||
cnt = buf[0];
|
||||
p_printf("r=%d b0=%d:", r, cnt);
|
||||
p_printf("r=%d b0=%d:", r, buf[0]);
|
||||
for (i = 0; i < 24 && i < 256; i++)
|
||||
p_printf(" %d", buf[i]);
|
||||
p_printf(" \"");
|
||||
|
||||
Reference in New Issue
Block a user