docs(wiki): printer USB transport + open-question for the provisioning
New concepts/printer-usb-transport.md (the seam, usblp char device, reachability-only status, threat model). open-questions #14: confirm the on-site printer is USB and bake the usblp + udev write-access rule into the appliance image (provisioning, not app code; unverified on hardware). Updated rongta-printer.md (USB transport note), index.md, log.md. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
+18
@@ -1588,3 +1588,21 @@ worker (one in-flight send/lamp, re-converges to the latest state → final stat
|
||||
in the UI works without a server restart. Workspace build+lint+test green (163 server tests). See
|
||||
[[dingtian-relay]] ("offline despite ping" + secret re-merge), [[button-light-indicator]] (serialized
|
||||
sends + hot-reload).
|
||||
|
||||
## [2026-06-24] build | Printer USB transport behind the ESC/POS render layer
|
||||
The ESC/POS printer drivers were **TCP-only** (every path went through `sendRaw`/`probe` to a raw
|
||||
socket on port 9100); the original BOM intended one adapter to cover "USB **or** network". Added a
|
||||
**USB transport** behind the existing render layer without touching a single `render*()` function:
|
||||
a discriminated `Transport` (`transportFromConfig` → `{kind:"tcp",host,port}` | `{kind:"usb",
|
||||
devicePath}`) and `sendTo`/`probeTo` dispatchers in `printer-escpos.ts`; USB writes the same ESC/POS
|
||||
bytes to a kernel **`usblp`** char device (`/dev/usb/lp0`) via a plain `fs` write — **no libusb/CUPS/
|
||||
native dep** (keeps MIT-only + minimal-deps appliance). `cashino` + `rongta` resolve a Transport once;
|
||||
both are reachability-only over USB, and the Rongta's HTTP **status page degrades to the open-the-node
|
||||
probe** over USB (no guessed paper/cover — the standing honesty rule). Non-`usb` configs are unchanged
|
||||
(host-only = TCP), so no migration. Setup UI gains a **Connection** select + **USB device** field;
|
||||
host/port made not-required so a USB printer needs neither. Tests: `printer-escpos.test.ts` (USB writes
|
||||
the exact rendered bytes; probe present/absent; `transportFromConfig` TCP back-compat) +
|
||||
`printer-cashino.test.ts` (USB-configured driver prints to the node, ready/offline). Devices suite
|
||||
green (29). **Flagged open-questions #14**: confirm the on-site printer is USB and bake the
|
||||
**usblp + udev write-access** rule into the appliance image (provisioning, not app code; unverified on
|
||||
hardware). See [[printer-usb-transport]], [[rongta-printer]].
|
||||
|
||||
Reference in New Issue
Block a user