vivier / phomemo-tools

CUPS driver for Phomemo M02 Label Printer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bluetooth communication is too fast.

yagshi opened this issue · comments

Hello. Thank you for your great work at first. Recently I've got a Phomemo M120 printer and tried your CUPS driver.
However, it only prints about 1/3 of a 30 mm long page. It seems that (at least) M120 requires slower data transfer. I tried a slow-transferring code (rastertoppm02.py) like this:

<     bytes = block.tobytes()
<     for i in range(lines):
<         stdout.write(bytes[image.width * i:image.width * (i + 1)])
<         stdout.flush()
<         time.sleep(0.05)
---
>     stdout.write(block.tobytes())

It works fine with my M120.

In addition, I'm using "gap paper", with which your original driver feeds an extra page after printing. So I also modified rastertopm02.py like this:

<         print_and_feed(stdout, 0)
---
>         print_and_feed(stdout, 2)

I hope this information helps you or others who use Phomemo printers.

Thank you.

Thank Yagshi just brought a M120 printer to use with Debian I'll let you know if you information helps when it arrives!

Fixed by
commit 82ba9ef (HEAD -> master, origin/master)
Author: Laurent Vivier laurent@vivier.eu
Date: Mon Jun 3 16:16:44 2024 +0200

cups: fix partial print with bluetooth

with recent OS it seems bluetooth is slower than before and sock.send()
doesn't send all data in one call, so we need to use smaller buffers and loop
on the remaining data to send the full picture

Signed-off-by: Laurent Vivier <laurent@vivier.eu>