Firstly, I would like to know how to tell on which port my serial POS printer is connected? When I do dmesg | grep tty I get:

[    0.000000] console [tty0] enabled
[    1.255791] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

I guess, it is connected to /dev/ttyS0? After that I did chmod 777 /dev/ttyS0

crwxrwxrwx 1 root dialout 4, 64 May 25 09:49 /dev/ttyS0

Then I tried to write like this echo -ne '\033[2J' > /dev/ttyS0 from here

I know the hardware is fine because it works when connected to parallel port. What did I missed?

  • if it works when connected to your parallel port, why switch it to serial? BTW, assuming /dev/ttyS0 is the correct device, you probably forgot to set the baud rate, start and stop bits, and parity settings. You can do that with stty...but first you need to know what the printer expects those settings to be (i.e. consult its manual).
    – cas
    May 25, 2016 at 8:36
  • Parallel port is already taken by another printer which has only parallel port. This POS printer for receipts has both.
    – Hrvoje T
    May 25, 2016 at 8:38
  • 1
    also, you can use statserial /dev/ttyS0 to see the hw line signals on that serial port. you can use that to find out which is the correct port. it's been a long time since i did much with serial ports, but IIRC you probably should have CTS=0 and DSR=1 if there's an active device on the port.
    – cas
    May 25, 2016 at 8:39
  • Good point. statserial works on port ttyS0 and not on ttyS1, so it is ttyS0. Now I know the port.
    – Hrvoje T
    May 25, 2016 at 8:44
  • 2
    also, check that you use correct cable. Normally, the DTE, Data Terminal Equipment (your printer) must have female D-SUB, while DCE, Data Control Equipment (your PC) must have male D-SUB. Anyway, check with specs on PC and printer that they have correct pin-outs, check that the cable is wired correctly as well, and check that you have synchronized flow-control settings between DTE and DCE
    – Serge
    May 25, 2016 at 11:31


You must log in to answer this question.

Browse other questions tagged .