Working Out the Polono D810 Protocol on Linux

2026-11-12

The Polono D810 is a portable A4/Letter direct thermal printer. It is a 203 dpi, USB and Bluetooth device: no ink, tear-off paper, and in principle a fairly simple thing to support. In practice, Polono supports USB printing on Windows and Mac, Bluetooth printing on Android and iOS, and not Linux.

I spent an afternoon working out enough of its protocol to send jobs from Linux Mint 22.3 through CUPS. The printer now accepts those jobs, reads their dimensions, advances the paper row by row, and appears to acknowledge the end of a job. One qualification belongs here, before anything else. For most of the afternoon I had no thermal paper, so nearly everything below was worked out without seeing a single printed dot. The first visible print came at the very end, on a supermarket receipt. A full A4 page on proper thermal sheets is still untested.

I did the work in a terminal, pairing with an AI coding assistant. The useful part was still the usual systems work: observe the device, find a nearby implementation, compare it with the vendor's implementation, and reduce the difference to bytes.

The missing Linux path

The machine was running Linux Mint 22.3, kernel 6.17, and CUPS. USB identified the printer as:

5958:0800 YXWL Mi Printer

The box says Polono while the USB descriptor names a different manufacturer, which suggests that Polono is a brand on OEM hardware. The device is a bidirectional USB printer-class device with two bulk endpoints and 64-byte packets. Its IEEE 1284 ID is more direct:

MFG:;CMD:XPP,XL;MDL:D810;CLS:PRINTER;DES:D810;

The kernel's usblp module exposed this particular device as /dev/usb/lp3, not the commonly assumed lp0.

There was no overlooked official package. Polono's driver page offers Linux drivers for the PL60 and PL70e-BT, but not the D810. A Linux Mint forum thread from November 2025 describes another D810 on Mint 22.1. Generic drivers produced black lines, Wine, PlayOnLinux, and Bottles failed, and the fix the owner settled on was to run Windows in VirtualBox with USB passthrough.

I first tried the open d80-cups-driver, written for the similar D80 family of Letter/A4 thermal printers. Its filter turns PDF into PNG, converts that to one bit, then sends ESC @ followed by GS v 0 raster data in 24-row stripes. CUPS reported success and delivered about 500 KB. The D810 did nothing.

That established an important but easy-to-forget boundary: CUPS saying that a job completed means that bytes reached the backend. It does not mean that the printer understood them, much less that anything appeared on paper.

Taking apart the Mac driver

The vendor does support macOS, and macOS printing uses CUPS. That made its package the best available description of the missing Linux side: a PPD and a CUPS filter, packaged for a different host architecture.

The Mac package is only about 80 KB. It is a xar archive, which 7z x can open, and its Payload is a cpio archive. Inside were a PPD, a launch daemon, and a filter named rastertolabel. The filter is a roughly 170 KB universal Mach-O binary containing x86_64 and arm64 code.

The PPD assigns the D810 model number 20 and feeds the filter 203 dpi, eight-bit gray CUPS raster. It exposes roll, fold, label, and tattoo-transfer media; three darkness levels; brightness, contrast, threshold, dithering, and feed offset. Roll paper is the default.

Running strings made the filter's ancestry obvious. It is the stock CUPS rastertolabel label filter with another model added. Zebra ZPL commands, Eltron EPL, CPCL, and HP PCL strings all remain in the binary. The D810 path was less convenient: it does not format command strings. It calls putchar one byte at a time.

I disassembled the x86_64 half on Linux with:

llvm-objdump --arch=x86_64 -d rastertolabel

Searching comparisons against 0x14, the PPD's model number 20, located the D810-specific image path. From there the protocol appeared in immediate values: instructions equivalent to movl $0x1f, %edi; callq putchar, one byte after another. It was tedious, but it also removed the guesswork.

The job on the wire

The earlier D80 attempt had sent raster data in stripes and little else. The D810 expects a complete job wrapper, and it expects the whole page as one GS v 0 block. An A4 page is 202 bytes wide and about 2329 rows high.

The per-job sequence recovered from the Mac filter is:

Order Bytes (hex) Meaning
1 00 x 128 Wake or synchronize.
2 10 FF F1 03 Start the job.
3 1F 90 01 <w> Set paper width in millimeters: D2 is 210 for A4, and D8 is 216 for Letter or Legal. This command is sent only for those widths.
4 1F 80 01 <t> Select media: 10 roll, 30 fold, 20 label, or 40 tattoo transfer.
5 10 FF 10 00 <d> Set darkness: 00 low, 01 medium, or 02 high.
6 1F 11 51 Sent for fold and label media. Its meaning is not decoded.
7 1D 76 30 00 wL wH hL hH plus data Standard ESC/POS GS v 0 raster. Width is in bytes, height is in rows, pixels are one bit each, black is 1, and bits are MSB first.
8 1D 0C for fold or label; 1B 4A n for roll or tattoo End the page by seeking the next mark, or by feeding a fixed number of dots. n is 80 for roll and F0 for tattoo.
9 10 FF FE 45 End the job.

The Mac driver's simplest pixel conversion marks a dot black when its gray value is below 0xC9, or 201. The reason the community D80 driver failed was now concrete: it sent the raster operation, corresponding to step 7, without the wake, start, media setup, page-end behavior, or job-end command around it.

Asking the printer directly

Opening /dev/usb/lp3 read-write also let me send short queries and read the answers. The useful subset was:

Query Reply Meaning
10 FF 40 00 or 04 Status: ready or no paper.
10 FF 50 F1 00 64 Battery level, 100.
10 FF 20 F0 D810 Model.
10 FF 20 F1 1.0.5 Firmware version.
10 FF 20 EF 1.01 A second version number, perhaps hardware or bootloader; unconfirmed.
10 FF 30 10 _240628_r2893 A build tag that looks like a date and revision.
10 FF 11 02 0A 00 Probably darkness readback because 02 matches High; unconfirmed.
10 FF 13 00 14 Probably a 20-minute automatic power-off setting; unconfirmed.

Standard ESC/POS status requests such as DLE EOT n, GS I n, and GS r n received no reply. The vendor protocol's replies have no framing, length, header, or checksum. Strings arrive as ASCII and numbers as raw bytes. A completed job also produces a bare ASCII OK, which can easily be mistaken for the answer to the next query.

The failures were useful

My first jobs disappeared silently. The status query returned 04, which turned out to mean no paper. The printer has to pull the sheet in under its own power until its light turns green. While the light is red, it accepts job data and drops the job without reporting an error to the host.

I made that worse with a helper that polled status once a second during paper loading. The sheet stopped halfway, apparently because the polling interfered with loading, so I stopped polling during that operation.

Then several full pages came out blank. I went back through the commands and the raster polarity before noticing the actual problem: I was using plain paper. One test sheet was a page from a book. A direct thermal printer only heats; the visible image forms in the paper's coating. Plain paper will feed perfectly and remain perfectly blank.

There was still a useful test available. I sent a job containing an 800-row image with no feed command. At 203 dpi, 800 rows are about 10 cm. The paper advanced about 10 cm and stopped, while status remained 00. Writing the 160 KB job took 12.4 seconds, which shows the device throttling USB to print speed. Together, those observations show that it parses the raster command and executes the image row by row. They do not show that the print head heats.

A later pass over the disassembly caught errors in my first driver version. I had defaulted to fold media when the vendor defaults to roll. Label media needs the same 1F 11 51 and 1D 0C treatment as fold media. I had also fed 510 dots after a page, while the vendor uses 128 for roll and 240 for tattoo transfer. I corrected all three.

Turning the protocol into a CUPS driver

The resulting pipeline is conventional:

application -> CUPS -> d810-filter -> Ghostscript at 203 dpi gray
            -> Pillow at 1 bit -> D810 commands -> CUPS usb backend -> printer

The core d810.py is about 170 lines of Python. It defines Paper, Media, and Darkness enums, a JobSettings dataclass, a byte-building D810Protocol class, a PdfRasterizer that invokes Ghostscript, and a small command-line interface. The encoder itself is small:

def job_header(self) -> bytes:
    out = bytearray(b"\x00" * 128)
    out += b"\x10\xff\xf1\x03"
    out += bytes([0x1F, 0x90, 0x01, self.s.paper.width_mm])
    out += bytes([0x1F, 0x80, 0x01, self.s.media.value])
    out += bytes([0x10, 0xFF, 0x10, 0x00, self.s.darkness.value])
    if self.s.media in (Media.FOLD, Media.LABEL):
        out += b"\x1f\x11\x51"
    return bytes(out)

@staticmethod
def raster(img: Image.Image) -> bytes:
    bw = img.convert("1")
    width_bytes = (bw.width + 7) // 8
    data = bytes(b ^ 0xFF for b in bw.tobytes())
    head = b"\x1d\x76\x30\x00" + width_bytes.to_bytes(2, "little") + bw.height.to_bytes(2, "little")
    return head + data

That XOR is the polarity boundary: Pillow represents 1 as white, while the printer represents 1 as black. Pillow performs the one-bit conversion with Floyd-Steinberg dithering.

The CUPS filter merges PPD defaults with the options on each job. The PPD offers A4, Letter, and Legal sizes along with media type and darkness, and declares:

*cupsFilter: "application/pdf 0 d810-filter"

The installer copies the pieces and creates a queue using the printer's USB serial URI, so the queue survives a move between USB ports. The source is on GitHub.

Two CUPS details cost time. First, cupsfilter, the usual test tool, did not run the custom filter for this PPD, while a real job through the queue did. The CUPS debug log confirmed the difference. Second, a CUPS filter's stdout is the printer data stream. Ghostscript inherits stdout unless told otherwise, so its stdout has to be redirected to stderr or it can corrupt that stream.

Where this leaves the driver

The protocol work was done for interoperability with an operating system the vendor does not support. It is entirely host-side: I did not extract or modify firmware, and no vendor package, binary, or PPD is redistributed. This is unofficial work and is not affiliated with or endorsed by Polono.

What I can claim is narrow but useful. The D810 answers the recovered queries, accepts wrapped jobs, reads image dimensions, advances paper by the requested rows, and appears to acknowledge job end. The 10 cm test is particularly good evidence that the raster path is being executed rather than merely buffered and discarded.

At that point I could not claim a visible print. Plain paper cannot test the heating side, and plain paper was all I had.

Update: the first print

Shortly after I wrote the above, I fed the printer the only thermal paper in the house: a supermarket receipt. I sent a roll-mode strip of repeated text across the full width of the head, so that some of it would land on the receipt wherever it sat. It printed, legibly, over the receipt's own text. The head heats, the raster polarity is right, and the recovered sequence is enough to print from Linux.

What remains unverified is narrower: a full A4 or Letter page on proper thermal sheets, where page size and margins may still need adjusting, and the fold, label, and tattoo media types. Thermal paper is on order.

linux, cups, printers, reverse-engineering

← Blog