code wiki / (root) / nx_printer_waste.nx

nx_printer_waste.nx

buildroot/runtime/nx_printer_waste.nx

4583 B96 linesdepth 1pulls 1 transitivereach 7 importersview sourcekind librarytopic printer
docsdependenciesstructsconstsfunctions

about

nx_printer_waste.nx -- honest supply + waste auditor (R4). Targets the operator's "wasteful as shit". Two concrete, evidence-grounded wastes (from the live Brother dump): (1) SUPPLY waste/awareness: marker-levels/marker-low-levels/marker-high-levels (parallel 1setOf integer arrays, one entry per ink/toner supply). We compute each supply's true % and an honest status (OK/LOW/EMPTY/UNKNOWN) so you neither run dry mid-job nor toss a cartridge early on a vendor "low" scare. Negative levels (-1/-2/-3) mean "unknown" (RFC 3805 Printer MIB) -> not a false 0%. (2) PAPER waste: a printer that SUPPORTS duplex but DEFAULTS to one-sided (the Brother does exactly this: sides-supported includes two-sided-long/short-edge, sides-default=one-sided) wastes paper on every default job. We flag it. NEVER-BRICK (#26): pure read-only model; no syscalls. Sovereign (imports only nx_ipp_codec.nx). genealogy_id: project-printer-management-ipp-sclass-2026-06-20 ; license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_ipp_codec.nx nx_printer_waste.nx nx_printer_query.nx nx_printer_waste_test.nx nx_printers_render.nx nx_toner_liberate.nx

imports: nx_ipp_codec.nx

imported by: nx_printer_query.nxnx_printer_waste_test.nxnx_printers_render.nxnx_toner_liberate.nx

structs

none

consts

17const NX_MAGIC_1000000: i64 = 1000000
20const NX_SUP_OK: i64 = 1
21const NX_SUP_LOW: i64 = 2
22const NX_SUP_EMPTY: i64 = 3
23const NX_SUP_UNKNOWN: i64 = 4
24const NX_SUP_N: i64 = 5
27const NX_DUP_OK: i64 = 1 // duplex is the default -> not wasting paper
28const NX_DUP_WASTE: i64 = 2 // duplex supported but defaults to one-sided -> paper waste
29const NX_DUP_UNSUPPORTED: i64 = 3 // no duplex hardware
30const NX_DUP_UNKNOWN: i64 = 4 // sides attributes not reported

functions

33func nx_pw_supply_status(lvl: i64, lo: i64, hi: i64, out_pct: *i64) -> i64
called by 1: nx_printer_waste
44func nx_pw_duplex(body: *u8, n: i64) -> i64
59func nx_printer_waste(body: *u8, n: i64, scratch: *i64,