nx_printer_waste.nx
buildroot/runtime/nx_printer_waste.nx
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
imports: nx_ipp_codec.nx
imported by: nx_printer_query.nxnx_printer_waste_test.nxnx_printers_render.nxnx_toner_liberate.nx
structs
| none |
consts
| 17 | const NX_MAGIC_1000000: i64 = 1000000 |
| 20 | const NX_SUP_OK: i64 = 1 |
| 21 | const NX_SUP_LOW: i64 = 2 |
| 22 | const NX_SUP_EMPTY: i64 = 3 |
| 23 | const NX_SUP_UNKNOWN: i64 = 4 |
| 24 | const NX_SUP_N: i64 = 5 |
| 27 | const NX_DUP_OK: i64 = 1 // duplex is the default -> not wasting paper |
| 28 | const NX_DUP_WASTE: i64 = 2 // duplex supported but defaults to one-sided -> paper waste |
| 29 | const NX_DUP_UNSUPPORTED: i64 = 3 // no duplex hardware |
| 30 | const NX_DUP_UNKNOWN: i64 = 4 // sides attributes not reported |
functions
| 33 | func nx_pw_supply_status(lvl: i64, lo: i64, hi: i64, out_pct: *i64) -> i64 called by 1: nx_printer_waste |
| 44 | func nx_pw_duplex(body: *u8, n: i64) -> i64 |
| 59 | func nx_printer_waste(body: *u8, n: i64, scratch: *i64, called by 3: mainnx_printers_rendernx_toner_liberate calls 3: nx_ipp_set_int_atnx_pw_supply_statusnx_pw_duplex |