hp-laser-1008a-macos README

The project's README from github.com/Kuberwastaken/hp-laser-1008a-macos. As one markdown file: README.md.

HP Laser 1008a on macOS (native Cmd-P driver)

Make the HP Laser 1003 / 1006 / 1008 (a/w), HP's rebadged Samsung SPL3 laser, print from Apple Silicon macOS like a normal printer. Cmd-P from any app. No terminal, no per-job scripts.

HP never shipped a working macOS driver for these. They are not AirPrint, they do not speak PostScript or PCL, and until recently the open-source SPL/QPDL drivers did not produce a stream this exact unit accepts. This project fixes that with a small patch to SpliX and drives the printer natively.

Tested on macOS 26 (Apple Silicon). USB-connected 1003 / 1006 / 1008 (a and w).

UPDATE: this driver is now fully native (and that is what we run)

It got progressively more native, and the current version is the real deal:

  1. First it ran HP's proprietary Linux rastertospl inside a Docker/colima Linux VM (the only thing that produced correct output at the time).
  2. Then we reverse engineered the actual bug (see The story), fixed it in SpliX with a 10-line patch, and dropped Docker/colima/ULD entirely.
  3. Now the USB write is a tiny native IOKit helper too, so Python, pyusb, and libusb are gone as well.

This is what the repo ships and what we use. The entire runtime is two compiled pieces on Apple's own frameworks: a patched SpliX rastertoqpdl CUPS filter (C++, system libcups) and hpl1008-usbd (C, IOKit + CoreFoundation). No Docker, no VM, no vendor binary, no Python, no Homebrew libraries. The SPL3 fix is being upstreamed to SpliX (issue #1).

Install (one command)

Plug the printer in over USB, then paste this into Terminal:

git clone https://github.com/Kuberwastaken/hp-laser-1008a-macos.git && cd hp-laser-1008a-macos && ./install.sh

It asks for your password once, builds the two native binaries, and sets up the printer as "HP Laser 1008a". Print from any app with Cmd-P. Prerequisites: Homebrew and the Xcode command line tools (xcode-select --install), both build-time only.

Test from the terminal: lp -d HP_Laser_1008a /etc/hosts. Remove everything: ./uninstall.sh.

How it works

flowchart LR
    A[Any app, Cmd-P] --> B[CUPS]
    B --> C[cgpdftoraster<br/>CUPS raster]
    C --> D[rastertoqpdl<br/>patched SpliX, C++]
    D -->|SPL3 / QPDL| E[hpl100x backend<br/>C + IOKit, root]
    E -->|USB bulk write| F[(HP Laser 1008a)]

Two non-obvious pieces make this work:

The backend runs as root. On recent macOS only root can drive USB, and the usb backend that ships with macOS refuses this printer (it mis-reads the port status as permanently "offline"). So the USB write lives in a small CUPS backend (hpl100x:/) installed 0700 root-owned: CUPS runs it as root and it does the raw write with IOKit (IOUSBInterfaceOpenSeize + WritePipe). The rest of the chain is a normal native CUPS filter. (The backend sandbox does permit IOKit USB; only the filter sandbox blocks it.)

The printer is dual-mode and macOS flips it. Interface 0 has alt 0 = 7/1/2 (classic raw printing) and alt 1 = 7/1/4 (IPP-over-USB), sharing bulk-OUT endpoint 0x02. macOS often leaves the interface on the IPP-USB alt, where the printer expects HTTP framing and silently drops raw SPL3. The backend reads the config descriptor, finds the classic interface/alt, and SetAlternateInterfaces back to it before writing. Run sudo /usr/libexec/cups/backend/hpl100x probe to dump the descriptor.

Earlier versions streamed SPL3 to a root LaunchDaemon over 127.0.0.1:9108 because the backend sandbox was assumed to block USB. It does not, so the socket and daemon are gone (see ROADMAP.md, V2). The daemon variant still lives in daemon/ + launchd/ as a fallback.

The story

The HP Laser 100 series is a genuinely awkward printer on a Mac:

What you'd try What happens
AirPrint / driverless Not offered. Its USB HTTP endpoint serves no IPP
Generic PCL / PostScript Printer speaks neither, the CUPS backend hangs "offline"
SpliX 2.0.1 No HP Laser 10x support at all
SpliX 2.0.2 (out of the box) Garbled: striped raster at the page origin, repeated sheets
HP's macOS driver Does not exist

SpliX 2.0.2 added HP Laser 10x support (QPDL v3, a band-width table), but on the 1008a it still printed a striped patch at the top-left of every sheet and then ejected and repeated. We diagnosed it without the printer by feeding an identical raster through both HP's rastertospl and SpliX and diffing the output:

HP's own binary confirmed it: disassembling rastertospl shows it computes the header as points * 300.0 / 72.0. SpliX already had that 300-dpi code; it was just wrongly coupled to JBIG. The fix (patches/300dpi-header.patch) decouples it and gates it on specialBandWidth, which is already true for these models. Bands stay 0x11. Ten lines.

Notes

Credits

Thanks to SpliX (the SPL/QPDL engine), @ValdikSS for the HP Laser 10x support in SpliX 2.0.2, @janrueth / photovirus for the macOS build patch, and Pierov's HP Laser 107a on Linux writeup. The 300dpi-header.patch here is the missing piece for the 1003/1008 series.

License

MIT for this glue (see LICENSE). SpliX and the patches are GPLv2.

hp-laser-1008a-macos (Kuberwastaken/hp-laser-1008a-macos)

Searching Database…

这是什么?这是一个原生 macOS 驱动,让 HP Laser 1003/1006/1008 (a/w) 打印机——即 HP 换牌贴标的 Samsung SPL3 激光打印机——能通过 Cmd-P 正常打印,因为 HP 从未为它们推出过可用的 macOS 驱动。
这是我打开的应用,还是后台驱动?它是一个 CUPS 打印机驱动/后端,而不是带界面的应用:由修补过的 SpliX CUPS 过滤器加一个小巧的原生 IOKit USB 辅助程序(hpl1008-usbd)组成,把打印机注册进 macOS,任何应用都能用 Cmd-P 向它打印。
需要先装 Homebrew 或 Xcode 工具吗?需要,Homebrew 和 Xcode 命令行工具(xcode-select --install)都是必需的,但只在构建时需要。
它装好就能直接用,还是有些怪癖?闲置后的第一次打印大约需要 10-15 秒,因为打印机正在从自动关机状态唤醒并加热定影器,这不是软件延迟。另外,macOS 可能把打印机的 USB 接口留在 IPP-USB 模式而不是经典 raw 模式,后端必须自行检测并切换回去。
Intel Mac 上也能用吗,还是只支持 Apple Silicon?它专门针对运行 macOS 26、通过 USB 连接打印机的 Apple Silicon Mac 构建和测试;Intel Mac 未被列为支持对象。
为什么不直接用通用的 PCL 或 PostScript 驱动?这台打印机既不支持 PCL 也不支持 PostScript(也不支持 AirPrint/IPP),任何通用驱动都只会让 CUPS 后端一直挂起显示离线。
现有的 SpliX 驱动到底哪里出了问题?SpliX 以 600 dpi 发送页眉几何信息,而这台打印机按 300 dpi 网格读取页眉,导致它以为页面远大于 A4;于是它打印一条横带就碰到真实的页面边缘,弹出纸张,然后再重复打印那张巨大的「剩余」页面。一个 10 行的补丁(300dpi-header.patch)修复了这个不匹配。
换成其他 HP Laser 100 系列的 USB 产品 ID 也能用吗?可以——USB 辅助程序是按 HP 的厂商 ID(0x03F0)和打印机类接口描述符来匹配的,而不是硬编码的产品 ID,所以其他 1003/1008 变体应该开箱即用。
它还需要像早期版本那样依赖 Docker 或 Python 吗?不需要——早期方案在 Docker/colima 虚拟机里运行 HP 的 Linux 驱动,后来又用过 Python/pyusb 守护进程,但当前版本用原生 IOKit C 辅助程序取代了这两者,因此不再需要 Docker、colima、ULD 和 Python。
Size
0.5 MB
Stars
175
Updated
CommitOct 04
Age
2mo
Commits · 90 Days