vivier / phomemo-tools

CUPS driver for Phomemo M02 Label Printer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

M110/M120 Bluetooth using CUPS

taylorjdlee opened this issue · comments

Hey I'm trying to connect the M120 printer via bluetooth but I'm having a hard time. I've tried to follow the guide and yes I can connect to the printer using the rfcomm connect command but I can't use the backend to connect to the printer via CUPS.

I've been trying to using this command sudo lpadmin -p M120 -E -v phomemo://047F0E775A68 -P /usr/share/cups/model/Phomemo/Phomemo-M110.ppd.gz followed by echo "This is test" | lp -d M02 -o media=w50h60 - to no avail

@daig0rian Any idea how to connect to bluetooth using the command line? As I know you have a M110, thanks!

If serial:/dev/usb/lp0 works and phomemo:// does not, there is probably a problem with the "phomemo" backend.

First, if you have not paired Bluetooth yet and want to do the same thing in the CUI as the GUI instructions in README.md, run the following command

$ bluetoothctl
[bluetooth]# scan on
[NEW] Device DC:0D:30:C2:CB:C5 Q192J27K0480025
[bluetooth]# pair DC:0D:30:C2:CB:C5
Attempting to pair with DC:0D:30:C2:CB:C5
Pairing successful
[bluetooth]# scan off
[bluetooth]# paired-devices
Device DC:0D:30:C2:CB:C5 Q192J27K0480025

And make sure the python module required for the "phomemo" backend is installed in the OS.
I am using Raspberry Pi OS 11.6 (Debian bullseye) and in addition to the commands in README.md, I needed the following additional commands.

sudo apt install python3-pip
sudo pip install pybluez
sudo apt install python3-dbus
sudo apt install python3-usb

Then I was able to print successfully with the following command same as README.md

sudo lpadmin -p M110-BT -E -v phomemo://DC0D30C2CBC5 -P /usr/share/cups/model/Phomemo/Phomemo-M110.ppd.gz
lp -d M110-BT -o media=w40h20 logo_150x150.png

At first this attempt did not work at all for me either, but I was able to solve the problem by investigate the following logs.
On Debian systems, logs can be found in /var/log/cups/.
If there is too little information available in the logs, use the following command to get a detailed log of CUPS.

sudo cupsctl --debug-logging
sudo /etc/init.d/cups restart

I checked the logs with debugging enabled and found the logs indicating the missing Python modules mentioned above.

To stop debug logging, use the following command

sudo cupsctl --no-debug-logging
sudo /etc/init.d/cups restart

By the way, in the 2.2.2.2. USB section of README.md, I see that serial: and phomemo:// are mixed up.

phomemo:// backend is actually also implemented for USB, but at first glance it doesn't seem to be considered for M120, so it might be better to change it with serial: at this point

I followed the above instructions and it worked. I was missing they pybluez module, exactly as stated.

B