AI

Claude Code Wrote a macOS Driver for an HP Printer That Never Had One: A 4-Hour Reverse-Engineering Odyssey

The HP Laser 1008a is a rebadged Samsung host-based printer that speaks a proprietary raster language (SPL3), ships no macOS driver, and supports no AirPrint. In one 4-hour Claude Code session, developer Kuber Mehta and Opus 4.8 reversed the print language from the printer's own error pages, bypassed the macOS USB sandbox, ran HP's real codec inside a Linux container, and shipped a one-command MIT-licensed installer. Full technical breakdown and what it means for AI agents doing driver work.

Keeping this site alive takes effort — your support means everything.
無程式碼也能輕鬆打造專業LINE官方帳號!一鍵導入模板,讓AI助你行銷加分! 無程式碼也能輕鬆打造專業LINE官方帳號!一鍵導入模板,讓AI助你行銷加分!
Claude Code Wrote a macOS Driver for an HP Printer That Never Had One: A 4-Hour Reverse-Engineering Odyssey

Key takeaways

  • The HP Laser 1008a is a rebadged Samsung host-based printer speaking only the proprietary SPL3/QPDL3 raster language — no macOS driver ever shipped, no AirPrint, no PostScript/PCL. Generic PCL hangs at 'connecting-to-device', splix 2.0.1 prints garbled stripes, and foo2zjs triggers a physical 'SPL ERROR - Please use the proper driver' page from the printer itself.
  • In one ~4-hour Claude Code session (Opus 4.8, 1M context), the agent reverse-engineered the solution: discovered the printer's bInterfaceProtocol=4 IPP-over-USB trap via ioreg, wrote a root-level PyUSB script to claim the raw USB interface and write to bulk endpoint 0x02, decoded the printer's self-printed error pages (offset 0x2000 = first raster scanline; 'Illegal Resolution' = hardware demands 600x600dpi), then containerized HP's real Linux rastertospl codec inside Colima to produce genuine SPL3.
  • The production architecture bypasses macOS 26's CUPS sandbox elegantly: CUPS renders raster and pipes it via the sandbox-blessed socket:// backend to 127.0.0.1:9108, where a root LaunchDaemon streams it into the Ubuntu container running HP's proprietary codec, and direct_write.py pushes the resulting SPL3 to the printer's bulk OUT endpoint — enabling native Cmd-P printing.
  • The HN community responded with an adversarial architecture review (splix 2.0.2 added Laser 10x support in July 2026, daemon I/O framing critique, hardcoded USB PID), which the author answered with a clean-room A/B test: even the updated splix 2.0.2 produced garbled output, empirically proving the containerized official codec approach was necessary.
  • The broader lesson: AI agents with long context windows can now do genuine hardware driver reverse-engineering — reading binary protocols from device error output, navigating OS sandboxes, and orchestrating containers — collapsing what used to be weeks of specialized driver work into a single afternoon. The result is MIT-licensed at github.com/Kuberwastaken/hp-laser-1008a-macos.

Key answers

What is the HP Laser 1008a problem?

The HP Laser 1008a is a rebadged Samsung host-based laser printer that only speaks Samsung Printer Language 3 (SPL3 / QPDL v3), a proprietary raster format. HP never shipped a macOS driver and it supports neither AirPrint nor standard languages like PostScript or PCL. On Apple Silicon Macs it's effectively bricked — generic PCL drivers hang at 'connecting-to-device' in CUPS, and open-source attempts (splix, foo2zjs) produce garbled output or trigger the printer to print its own 'SPL ERROR - Please use the proper driver' page.

How did Claude Code reverse-engineer the print language?

The key trick was using the printer itself as documentation: when fed wrong-format data, the HP Laser 1008a prints a physical self-diagnostic error page stating the exact failure position (e.g. 'SPL ERROR at POSITION: 0x2000', which is where the first compressed raster scanline begins) and the accepted resolution ('Illegal Resolution' for anything other than 600x600dpi). Claude Code also used ioreg to discover the printer's bInterfaceProtocol=4 (IPP-over-USB) trap that caused the raw USB backend to misread the device as permanently busy.

How does the final driver architecture work?

The pipeline is: macOS app → CUPS (renders uncompressed raster) → CUPS socket backend to 127.0.0.1:9108 (sandbox-blessed localhost stream) → hpl1008-daemon (root LaunchDaemon) → Colima Linux ARM64 container running HP's proprietary rastertospl + libscmssc.so codec → genuine SPL3 output → direct_write.py (root PyUSB/libusb script that detaches the kernel driver and writes to bulk OUT endpoint 0x02) → the printer. This bypasses macOS 26's CUPS sandbox, which blocks custom filters from touching raw USB or running docker.

Why not just use the open-source splix driver?

The author's original attempt used splix 2.0.1, which produced striped, garbled scanlines. An HN reviewer pointed out splix 2.0.2 (July 2026) added official HP Laser 10x family support with QPDLVersion 3 and forced 512-byte packets. The author ran a clean-room A/B test compiling splix 2.0.2 natively on macOS — and it still produced garbled output. Only HP's real Linux rastertospl codec, containerized via Colima, produced flawless pages. The vendor codec encodes compression the open-source drivers don't.

What did the HN community think?

The project hit the front page and drew an adversarial architecture review: critiques included the heavyweight Colima/Docker dependency, a fragile 2-second silent timeout for job framing in the daemon, and a hardcoded USB product ID (0x069E) that excludes sibling printers (1003/1006). The author addressed each — including the empirical A/B test proving splix 2.0.2 still fails — and the repo gained ~50 stars within hours.

Claude Code Wrote a macOS Driver for an HP Printer That Never Had One

On August 17, 2026, a developer named Kuber Mehta posted something unusual on X: a complete, lightly-redacted transcript of a 4-hour Claude Code session in which an AI agent made an obscure Windows-only printer work natively from Cmd-P on macOS — a printer HP never shipped a Mac driver for.

The post blew up. Then the GitHub repo (github.com/Kuberwastaken/hp-laser-1008a-macos) hit Hacker News. The HN thread delivered what HN always delivers: a brutal adversarial code review, answered with a clean-room A/B test.

This is the story of that session — and what it says about AI agents doing work that used to take driver engineers weeks.

The problem: a printer that only speaks Samsung

The HP Laser 1008a is a cheap, rebadged Samsung host-based laser printer. “Host-based” means it’s a dumb device: the computer must rasterize everything into raw compressed scanlines and push them over the wire in SPL3 (Samsung Printer Language 3 / QPDL v3), a proprietary format.

  • No macOS driver — HP never shipped one for this family
  • No AirPrint — not even driverless IPP
  • No PostScript, no PCL — generic drivers can’t talk to it

On an Apple Silicon Mac, the device is effectively bricked. Prior attempts all failed:

ApproachResult
Generic PCL/PostScript PPDCUPS hangs forever at connecting-to-device
splix 2.0.1 (open-source SPL driver)Garbled striped scanlines + endless blank pages
foo2zjs / foo2qpdlPrinter prints a physical error page: SPL ERROR - Please use the proper driver

The 4-hour journey

Step 1: The false-offline trap

Claude added the printer with the generic PCL driver. The job hung at connecting-to-device and CUPS reported the printer offline. Digging with ioreg, Claude found the real culprit: the printer exposes bInterfaceProtocol = 4IPP-over-USB (AirPrint-over-USB mode). The macOS raw USB backend misreads that status byte as “permanently busy,” wedging the device in STATUS:BUSY until a power cycle.

Step 2: The macOS sandbox wall

On macOS 26, only root processes can talk to raw USB interfaces — and CUPS print filters are strictly sandboxed, blocked from raw USB entirely. Claude’s answer: a standalone root-level Python script (direct_write.py) using PyUSB/libusb to claim Interface 0 / Alternate Setting 0 (classic raw bidirectional printing), detach the Apple kernel driver, and write directly to bulk OUT endpoint 0x02. Transport solved: 56,738 bytes pushed cleanly.

Step 3: The printer teaches Claude its own language

Raw transport alone wasn’t enough — the open-source encoder produced garbage. Claude compiled foo2qpdl from foo2zjs and the printer responded by printing a crisp, legible self-diagnostic error page:

SPL ERROR - Please use the proper driver at POSITION: 0x2000 (8192)

0x2000 is exactly where the first compressed raster scanline begins — the printer parsed the PJL headers but choked on the compression. A second test at 1200x600dpi produced Illegal Resolution. The hardware was literally telling Claude what it wanted: 600x600dpi, and an encoder it could decode.

Step 4: Containerizing HP’s real codec

The printer demanded “the proper driver” — which HP distributes as an arm64 Linux binary (rastertospl) inside the HP Unified Linux Driver. Claude booted Colima (a lightweight ARM64 Linux VM for macOS), built an Ubuntu container with HP’s proprietary rastertospl + libscmssc.so, fed it standard CUPS raster via stdin, and got genuine vendor-compiled SPL3 back on stdout. Pushed through direct_write.py — a flawless page printed.

Step 5: Wiring it into Cmd-P (the CUPS socket bypass)

The final challenge: CUPS’s hardened sandbox blocks custom filters from running docker or even logging. Claude’s elegant solution — split the architecture:

macOS App (Cmd-P)
CUPS Print Queue (renders uncompressed raster)
CUPS Socket Backend → 127.0.0.1:9108   ← sandbox-blessed localhost stream
hpl1008-daemon (root LaunchDaemon)
      │  (streams CUPS raster via stdin)
Colima Linux ARM64 Container (hp-spl)
   └── HP proprietary rastertospl + libscmssc.so
      │  (SPL3 via stdout)
direct_write.py (root PyUSB/libusb, endpoint 0x02)
HP Laser 1008a ✅

CUPS’s built-in JetDirect socket:// backend is already sandbox-blessed for localhost network streams — so the daemon listens on port 9108, receives raster, streams it through the container, and pushes SPL3 to the printer. Native Cmd-P printing, reboot-safe (LaunchDaemon), delivered as a one-command MIT-licensed installer.

The HN gauntlet: review → A/B test → verdict

HN delivered its trademark adversarial review:

  1. “splix 2.0.2 fixed this” — the reviewer noted SpliX 2.0.2 (July 2026) added HP Laser 10x support with QPDLVersion 3, forced 512-byte packets, and a Samsung-matching bandwidth table
  2. Daemon critique — the 2-second silent timeout for job framing is fragile; use TCP EOF boundaries instead
  3. Hardcoded USB PID (0x069E) — excludes the 1003/1006 siblings

The author’s response was the best kind of science: a clean-room A/B test. Claude compiled splix 2.0.2 natively on macOS, verified the new bandwidth logic engaged (608-byte bandwidth for A4), and fed the raw QPDL-v3 output through the same USB writer.

Result: total failure. Garbled scanlines again. The vendor codec’s compression encoding is simply not replicated by the open-source drivers — the containerized official codec was the necessary path.

What this means for the future of driver work

This session is a genuine milestone for AI agents:

  • Reading protocols from device behavior — the printer’s own error pages became documentation
  • Navigating OS security models — sandbox analysis, root daemons, socket bypasses
  • Orchestrating heterogeneous toolchains — macOS + Linux VM + container + vendor binaries
  • Iterating on hardware feedback — physical pages as test output, ~4 hours of loop-closing

Traditionally, this was weeks of specialized driver engineering: reverse-engineering a proprietary raster format, fighting macOS sandboxing, and packaging an installer. One agent, one session, one afternoon — then published MIT-licensed for the world.

The printer still can’t AirPrint. But it now works from Cmd-P on any Mac — because an AI agent decided “no driver exists” wasn’t an answer. 🖨️