add --serial and --list-connected to pick one of several printers

When more than one printer is connected, ptouch-print used the first
one it found. --serial <serial> now uses only the printer with that USB
serial number, and --list-connected lists the connected printers with
their serials.

libptouch gets ptouch_open_serial() and ptouch_list_connected();
ptouch_open() keeps its signature and calls ptouch_open_serial() with
NULL. The serial is checked before the P-Lite and unsupported-raster
checks, so a different printer in the wrong mode no longer ends the
search, and the "found on USB bus" line now shows the serial. The early
error returns in the open loop now free the device list.
This commit is contained in:
James A
2026-09-25 09:51:25 +02:00
committed by Dominic Radermacher
parent d05d31bb86
commit 7fa1e1ac46
4 changed files with 115 additions and 9 deletions
+7
View File
@@ -34,6 +34,10 @@ Set the seconds ptouch-print is waiting for finishing a previous ptouch-print co
Default is 1 second. 0 (zero) means wait forever.
Useful if ptouch-print is used in a script multiple times, and the device is waiting for the user
to use the mechanical cutter.
.TP
.BR \-\-serial\ \fI<serial>
Use the printer with this USB serial number, when more than one printer is connected.
Use \-\-list\-connected to see the serial numbers.
.SS "Font selection options"
.TP
@@ -90,6 +94,9 @@ Show info about the tape detected (like printing width etc.) and exit.
.TP
.BR \-\-list-supported
List all supported printers
.TP
.BR \-\-list-connected
List all connected printers with their USB serial numbers, for use with \-\-serial
.SH DEFAULTS
The default font used is 'DejaVuSans'.