AndBondStyle / niimprint

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

D110 disconnects when I attempt to print the sample figure #29

Open icarosadero opened 5 months ago

icarosadero commented 5 months ago

I am on Kubuntu 22.04 and tried to use this tool for the D110 model using Python 3.11. Initially, it connects just fine to the Bluetooth, but when I try to print anything like the example picture, it disconnects:

(.venv) *[main][~/.../niimprint]$ python -m niimprint -c bluetooth -m d110 -a 03:04:02:9A:EA:21 -r 90 -i examples/B21_30x15mm_240x120px.png
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/<REDACTED>/Documents/repos/niimprint/niimprint/__main__.py", line 96, in <module>
    print_cmd()
  File "/home/<REDACTED>/Documents/repos/niimprint/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<REDACTED>/Documents/repos/niimprint/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
          ^^^^^^^^^^^^^^^^
  File "/home/<REDACTED>/Documents/repos/niimprint/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<REDACTED>/Documents/repos/niimprint/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<REDACTED>/Documents/repos/niimprint/niimprint/__main__.py", line 71, in print_cmd
    transport = BluetoothTransport(addr)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<REDACTED>/Documents/repos/niimprint/niimprint/printer.py", line 66, in __init__
    self._sock.connect((address, 1))
OSError: [Errno 112] Host is down
(.venv) *[main][~/Documents/repos/niimprint]$ 

I have also tried to connect to it via USB, but when I plug it in, nothing new shows up when I do ls /dev/tty*. Is this a driver issue?

icarosadero commented 5 months ago

Oh btw, I have also tried it without the -r 90 argument

AndBondStyle commented 5 months ago

@icarosadero for bluetooth connection, I suggest trying connecting to different addresses (check readme for details). The problem could also be in keepalive (you need to print something quickly after connecting). For USB connection, by default the printer is just charging, so you need to press its power button to wake it up and activate the serial mode.

P.S. This is my experience with B21 model, hopefully it's the same with D110