$ lsusb
...
Bus 003 Device 013: ID 0493:b002 MAG Technology Co., Ltd
...
You can see the serial port in the dmesg and in /dev:
$ dmesg
...
usb 3-3.7.2: new full-speed USB device number 13 using xhci_hcd
usb 3-3.7.2: New USB device found, idVendor=0493, idProduct=b002, bcdDevice= 3.00
usb 3-3.7.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-3.7.2: Product: USB Virtual COM
usb 3-3.7.2: Manufacturer: Nuvoton
usb 3-3.7.2: SerialNumber: A02014090305
cdc_acm 3-3.7.2:1.0: ttyACM0: USB ACM device
usblp 3-3.7.2:1.2: usblp0: USB Bidirectional printer dev 13 if 2 alt 0 proto 2 vid 0x0493 pid 0xB002
$ ls -lrt /dev
...
drwxr-xr-x. 2 root root 100 Dec 5 17:44 usb
crw-rw----. 1 root dialout 166, 0 Dec 5 17:44 ttyACM0
...
$ ls -lrt /dev/usb
total 0
crw-------. 1 root root 180, 96 Dec 5 16:46 hiddev0
crw-------. 1 root root 180, 97 Dec 5 16:46 hiddev1
crw-rw----. 1 root lp 180, 0 Dec 5 17:44 lp0
Send the picture to the printer (the python script currently only works with M02 printers):
Then you can build and install phomemo-tools files:
$ cd cups
$ make
$ sudo make install
To connect using USB, you need python3-pyusb.
For instance, on Fedora:
$ sudo dnf install python3-pyusb
On Fedora, SELinux seems to prevent the backend to create a bluetooth socket.
If you have such error message in your syslog:
localhost.localdomain cupsd[2659]: Can\'t open Bluetooth connection: [Errno 13] Permission denied
You might need to disable SELinux enforcement to allow the backend to run correctly:
$ sudo semanage permissive -a cupsd_t
I didn't find a way to define correctly the SELinux rules to allow the backend
to use bluetooth socket without to change the enforcement mode
(the couple ausearch/audit2allow doesn't fix the problem).
2.2.2.1.1. Pair the printer
Switch on the printer
Open the "Settings" window:
Select the "Bluetooth" Panel:
Select your bluetooth printer (here "Mr.in_M02"):
Your printer must be paired but not connected ("Disconnected"):
Select the "Printers" Panel:
You'll probably need to unlock it to be able to add a new printer.
Click on "Add a Printer...".
Select your printer and click on "Add":
Your printer will appear in the printers list:
Click on the settings menu of the printer and select "Printing Options":
Select "Media Size Label 50mmx70mm" and click on "Test Page":
Check the result:
This definition will use the "phomemo" backend to connect to the printer:
Use ”Phomemo-M110.ppd.gz”. This driver is compatible with M110, M120, and M220.
The -p option defines the printer name. It should be changed according to the printer used.
Use ”Phomemo-M110.ppd.gz”. This driver is compatible with M110, M120, and M220.
The -p option defines the printer name. It should be changed according to the printer used.
0x1d 0x76 0x30 -> command GS v 0 : print raster bit image
0x00 mode: 0 (normal), 1 (double width),
2 (double-height), 3 (quadruple)
0x30 0x00 16bit, little-endian: number of bytes / line (48)
0xff 0x00 16bit, little-endian: number of lines in the image (255)
Values seem to be 16bit little-endian
If the picture is not finished, a new block marker must be sent with
the remaining number of line (max is 255).
0x1b 0x64 -> command ESC d : print and feed n lines
0x02 number of line to feed
0x1b 0x64 -> command ESC d : print and feed n lines
0x02 number of line to feed
0x1f 0x11 0x08
0x1f 0x11 0x0e
0x1f 0x11 0x07
0x1f 0x11 0x09
Each line is 48 bytes long, each bit is a point (384 pt/line).
size of a line is 48 mm (80 pt/cm or 203,2 dpi, as announced by Phomemo).
ratio between height and width is 1.
1a 04 5a
1a 09 0c
1a 07 01 00 00
1a 08
51 30 30 31 45 30 XX XX XX XX XX XX XX XX XX -> Serial Numer: E05C0XXXXXX
4. Protocol for M110/M120/M220
Dumpping USB packets.
0x1b 0x4e 0x0d -> Print Speed
0x05 range: 0x01 (Slow) - 0x05 (Fast)
0x1b 0x4e 0x04 -> Print Density
0x0f range: 01 - 0f
0x1f 0x11 -> Media Type
0x0a Mode: 0a="Label With Gaps" 0b="Continuas" 26="Label With Marks"
0x1d 0x76 0x30 -> command GS v 0 : print raster bit image
0x00 mode: 0 (normal), 1 (double width),
2 (double-height), 3 (quadruple)
0x2b 0x00 16bit, little-endian: number of bytes / line (43)
0xf0 0x00 16bit, little-endian: number of lines in the image (240)