1

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.

1

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.

STTY Manual

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.

0

I'd typically go through the CUPS localhost web interface to attempt to add any printer. You could try the following steps to do the same for this serial printer:

  1. Point the web browser to http://localhost:631
  2. Select [Add Printer]
  3. Fill in the name, location and description.
  4. Select the "Serial Port #1" device.
  5. Fill in the appropriate settings for baud rate parity, etc..
  6. Select the correct printer make.
  7. Select the correct printer model, click [Add Printer]
  8. Since the serial port many not display in the CUPS device list, this will need to be changed to the correct tty device:
  9. Edit the /etc/cups/printers.conf file and change ttyS0 to the appropriate tty device.
  10. Restart the cups daemon:

    $ sudo service cups restart
    

References

6
  • Yeah, but I can't see any serial ports in cups, so I can't select "Serial Port #1" option. – bluepawel Mar 1 '14 at 13:05
  • Don't you see /dev/tty...? That's the device to select. – slm Mar 1 '14 at 13:11
  • No, in cups I can't see it. – bluepawel Mar 1 '14 at 13:23
  • Can you get us the output of lshw? – slm Mar 1 '14 at 13:27
  • I don't have lshw and it isn't available in repository for my system (Arch Linux). – bluepawel Mar 1 '14 at 13:30
0

What works for me is adding the serial printer as if it were a network printer, e.g. choosing "LPD/LPR-Host" or "Internet Printing Protocol (ipp)" and then entering as URL the path to the device, e.g.:

serial:/dev/ttyAMA0

or in my case, using a serial to USB adapter:

serial:/dev/ttyUSB0

You can see which device the printer is attached to by looking at the output of dmesg shortly after connecting the printer.

In the following steps, you need to select the correct baud rate and other options that you might get from the printer by pressing a certain button. (In my case, with Epson TM-U220, I can press FEED button while turning printer on.)

You also need to select the correct printer driver of course, e.g. an appropriate PPD file you might need to download from the manufacturer.

Finally, for making it work, I needed to create a new udev rule, e.g. in file /etc/udev/rules.d/99-own.rules:

KERNEL=="ttyUSB0", GROUP="lp", MODE="0660"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.