AndBondStyle / niimprint

Python library for Niimbot label printers. Supports D11/B21/B1 via bluetooth or USB.
MIT License
215 stars 31 forks source link

B1 printing a blank label #17

Open MoshiBin opened 7 months ago

MoshiBin commented 7 months ago

When I try to print any image, the the printer just prints an empty label with nothing printed on it. Printing from the app works correctly - so it's not a hardware issue. This is a B1, firmware version 5.10.

Here's one verbose log of trying to print one of the example files:

$ poetry run python -m niimprint -v -i examples/B21_30x15mm_240x120px.png -c bluetooth -a "$PRINTER_ADDR" 
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'pHYs' 41 9
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 62 5054
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:05:25:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:31:01:01:31:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:23:01:01:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:33:01:01:33:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:01:01:01:01:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:02:01:01:02:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:03:01:01:03:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:04:01:01:04:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:13:04:00:78:00:f0:9f:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:14:02:01:00:17:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:e3:01:01:e3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:d3:03:00:77:01:a6:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:e4:01:01:e4:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:01:f4:aa:aa

I also tried creating a file with the exact dimensions for my label - it's 40mm x 30mm so I went with (40mm * 8ppmm) - 16px = 304px by (30mm * 8ppmm) - 16px = 224px - same issue, label prints empty.

$ poetry run python -m niimprint -i dummy_304x224_000_fff.png -v -r 90 -c bluetooth -a "$PRINTER_ADDR" 
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'sRGB' 41 1
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 54 5346
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:05:25:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:31:01:01:31:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:23:01:01:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:33:01:01:33:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:01:01:01:01:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:02:01:01:02:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:03:01:01:03:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:04:01:01:04:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:13:04:01:30:00:e0:c6:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:14:02:01:00:17:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:e3:01:01:e3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:d3:03:00:c7:01:16:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:d3:03:01:2f:01:ff:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:e4:01:01:e4:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:01:f4:aa:aa

Looking at #3 I thought I had the same issue, so I picked the PR #12 and tried again, still printed a blank label:

Long verbose log snippet ```sh $ poetry run python -m niimprint -i dummy_304x224_000_fff.png -v -r 90 -c bluetooth -a "$PRINTER_ADDR" DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13 DEBUG | PngImagePlugin:call:190 - STREAM b'sRGB' 41 1 DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 54 5346 DEBUG | printer:_log_buffer:152 - send: 55:55:21:01:05:25:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:31:01:01:31:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:23:01:01:23:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:33:01:01:33:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:01:01:01:01:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:02:01:01:02:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:03:01:01:03:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:04:01:01:04:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:13:04:01:30:00:e0:c6:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:14:02:01:00:17:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:e3:01:01:e3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:d3:03:00:c7:01:16:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:d3:03:01:2f:01:ff:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:e4:01:01:e4:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:00:00:01:ef:00:01:00:00:56:aa:aa Progress: 0 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:00:01:ef:00:01:00:00:32:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:00:01:ef:00:01:00:00:32:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:00:01:ef:00:01:00:00:32:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:00:01:ef:00:01:00:00:32:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:00:01:ef:00:01:00:00:32:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:00:01:ef:00:01:00:00:32:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:01:01:ef:00:01:00:00:33:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:01:01:ef:00:01:00:00:33:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:01:01:ef:00:01:00:00:33:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:01:01:ef:00:01:00:00:33:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:02:01:ef:00:01:00:00:30:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:02:01:ef:00:01:00:00:30:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:02:01:ef:00:01:00:00:30:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:03:01:ef:00:01:00:00:31:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:03:01:ef:00:01:00:00:31:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:03:01:ef:00:01:00:00:31:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:03:01:ef:00:01:00:00:31:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:04:01:ef:00:01:00:00:36:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:04:01:ef:00:01:00:00:36:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:04:01:ef:00:01:00:00:36:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:05:01:ef:00:01:00:00:37:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:05:01:ef:00:01:00:00:37:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:05:01:ef:00:01:00:00:37:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:05:01:ef:00:01:00:00:37:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:06:01:ef:00:01:00:00:34:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:06:01:ef:00:01:00:00:34:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:06:01:ef:00:01:00:00:34:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:06:01:ef:00:01:00:00:34:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:07:01:ef:00:01:00:00:35:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:07:01:ef:00:01:00:00:35:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:07:01:ef:00:01:00:00:35:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:07:01:ef:00:01:00:00:35:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:08:01:ef:00:01:00:00:3a:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:08:01:ef:00:01:00:00:3a:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:09:01:ef:00:01:00:00:3b:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:09:01:ef:00:01:00:00:3b:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:09:01:ef:00:01:00:00:3b:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:09:01:ef:00:01:00:00:3b:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0a:01:ef:00:01:00:00:38:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0a:01:ef:00:01:00:00:38:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0a:01:ef:00:01:00:00:38:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0a:01:ef:00:01:00:00:38:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0a:01:ef:00:01:00:00:38:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0b:01:ef:00:01:00:00:39:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0b:01:ef:00:01:00:00:39:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:0b:01:ef:00:01:00:00:39:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:12:01:ef:00:01:00:00:20:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:15:01:ef:00:01:00:00:27:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:18:01:ef:00:01:00:00:2a:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:1b:01:ef:00:01:00:00:29:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:1f:01:ef:00:01:00:00:2d:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:22:01:ef:00:01:00:00:10:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:25:01:ef:00:01:00:00:17:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:28:01:ef:00:01:00:00:1a:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:2b:01:ef:00:01:00:00:19:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:2e:01:ef:00:01:00:00:1c:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:32:01:ef:00:01:00:00:00:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:37:01:ef:00:01:00:00:05:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:3d:01:ef:00:01:00:00:0f:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:41:01:ef:00:01:00:00:73:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:45:01:ef:00:01:00:00:77:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:49:01:ef:00:01:00:00:7b:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:4f:01:ef:00:01:00:00:7d:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:55:01:ef:00:01:00:00:67:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:5c:01:ef:00:01:00:00:6e:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:60:01:ef:00:01:00:00:52:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:00:64:63:01:ef:00:01:00:00:51:aa:aa Progress: 100 DEBUG | printer:_log_buffer:152 - send: 55:55:a3:01:01:a3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:b3:0a:00:01:64:00:01:ef:00:01:00:00:33:aa:aa DEBUG | printer:_log_buffer:152 - send: 55:55:f3:01:01:f3:aa:aa DEBUG | printer:_log_buffer:152 - recv: 55:55:f4:01:01:f4:aa:aa ```
aprosvetova commented 7 months ago

I had the same problem with D101. I compared the BT traffic I sniffed and the bytes niimprint is trying to send.

The discrepancies I found:

  1. niimprint sends "start page print", niimbot app doesn't (wtf?)
  2. niimprint sets dimension as 4 bytes struct.pack(">HH", w, h), niimbot sends 6 bytes instead (more like struct.pack(">HHH", w, h, 1))

There might be more differences (like it alternates between 0x84 and 0x85 for image packets), but I haven't looked deeper, because I just tried fixing the set_dimension packet and it worked! My D101 printed a 12x40 mm label (96x320 px) without any issues. I didn't even need to apply the patch from #12, and to be fair the niimbot app bt traffic suggests that it's not necessary.

I have no idea what the "1" part in set_dimension means though. I don't have any other labels to test this with.

AndBondStyle commented 7 months ago

@aprosvetova do you mind sharing the traffic capture? I'm trying to collect data for different models to analyze protocol differences.

aprosvetova commented 7 months ago

Here you go @AndBondStyle. I started recording shortly before printing, the actual printing begins around packet 43-49 and ends with the last packets of my dump. d101.csv

aprosvetova commented 7 months ago

Oh, I forgot to add something important. These are cleaned up BLE packets, the original app uses BLE to communicate to the printer. That's where the weird MAC address with the first 3 bytes rotated is used. Happily, the good old rfcomm approach still works on the other MAC, with the same payloads.

Mugne2010 commented 7 months ago

Sorry,one question,does this disables NFC so i can use any label?Thank you

aprosvetova commented 7 months ago

@Mugne2010 nope the NFC part is handled by the printer. The printer even stores the amount of uses per label serial number to not let you go backwards with it. I cloned the tag when I had 17 uses, then printed a new label, tried emulating the first dump, and the printer still returned 18 uses.

Some deeper analysis is needed though. Say, if we are able to change the serial number in the dump, we might make the printer think it’s a new label. I’m pretty sure it won’t be easy, they either sign the tag content or straight up encrypt it.

If anyone is interested to look more into it, the NTAG password is 12 34 56 78.

MoshiBin commented 6 months ago

I tried changing the set_dimension function to send the extra two bytes as mentioned above, unfortunately my B1 still prints an empty label.

aprosvetova commented 6 months ago

@MoshiBin I'd suggest you to record the traffic between your printer and the app. Maybe there are more differences in packets for your printer model.

You can share the dump here if you need help reading it.

marekmicek commented 4 months ago

I have a B1 hardware version 5.10, firmware version 5.11. It was also printing blanks for me. Turned out to be the same issue as for @aprosvetova. In addition I needed to increase the timeout as with only this fix the printing was cut in the middle.

sniffed data: data_sent_niimbot.txt

patch: patch.txt

etaloncop commented 3 months ago

The updated setdimensions work on B21S, the third parameter is quantity

theopoon commented 1 month ago

Same here on B1, I try print via USB instead, also blank label

$ python3 niimprint -v -m b1 -c usb -a /dev/ttyACM0 -r 90 -i ./384x240.png
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'sRGB' 41 1
DEBUG | PngImagePlugin:call:190 - STREAM b'gAMA' 54 4
DEBUG | PngImagePlugin:call:190 - STREAM b'pHYs' 70 9
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 91 2789
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:05:25:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:31:01:01:31:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:23:01:01:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:33:01:01:33:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:01:01:01:01:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:02:01:01:02:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:03:01:01:03:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:04:01:01:04:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:13:04:01:80:00:f0:66:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:14:02:01:00:17:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:e3:01:01:e3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:d3:03:00:c7:01:16:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:d3:03:01:7f:01:af:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:e4:01:01:e4:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:01:f4:aa:aa
MultiMote commented 1 month ago

@theopoon you can try to test your B1 here.

If it is working for you, it is unimplemented protocol problem and niimprint need some code changes to make this printer work.

theopoon commented 1 month ago

@theopoon you can try to test your B1 here.

If it is working for you, it is unimplemented protocol problem and niimprint need some code changes to make this printer work.

Yes, confirm it does work with the link.