Printing on serial printer via cups
I wouldn't go through cups:
CUPS is very problematic about RAW devices.
It's much easier to do it like so:
#!/bin/bash
cu -E `` /dev/ttyAMA0 < $1
(I can't remember for sure if you are requiring back-ticks (``) or single-quotes ('').
- cu calls up the modem.
- [-E ``] sets the escape sequence to null.
- < redirects $1 to the modem over the serial line.
- cu provides systematic modem locking, assuring you can't call up the modem in the middle of a call.
However, you also require to invoke the stty command to set your baud rate, parity, data bits, and stop bit.
And one last thing... Make sure your serial device is owned by the user you are intending to run the command from:
chown user:group /dev/ttyAMA0
Invocation:
$> yourScriptIJustMadeForYou yourFileThatYouArePrinting
Then tie that script in /usr/bin to be interoperable with your broader requirement. You can also setup a new printer with no device in CUPS which, enable this script in it as a filter. Voila. Done.
Related videos on Youtube
bluepawel
Updated on September 18, 2022Comments
-
bluepawel over 1 year
I'm trying to set up my serial printer with cups, but I can't see any serial port in cups config page nor via
lpinfo -v
. I have serial port at/dev/ttyAMA0
. I was trying to set proper permissions for/dev/ttyAMA0
and/usr/lib/cups/backend/serial
, but without success. -
bluepawel about 10 yearsYeah, but I can't see any serial ports in cups, so I can't select "Serial Port #1" option.
-
slm about 10 yearsDon't you see
/dev/tty...
? That's the device to select. -
slm about 10 yearsCan you get us the output of
lshw
? -
bluepawel about 10 yearsI don't have lshw and it isn't available in repository for my system (Arch Linux).
-
slm about 10 yearsThat's strange, I'm pretty sure that's avail. for Arch. Do you have
hwinfo
?