How do I print directly to LPT port in Ubuntu?

7

1

While screwing around my garage, I've found an ancient matrix printer, Epson LX-1050. Ubuntu recognised it without problems, and I was able to print several pages using it via CUPS.

Now, for some reason, I want to use this printer the way it was designed back in 1994: to write directly to parallel port. I've tried the most simplistic approach that works to operate my USB 3G modem:

echo "Y helo thar" > /dev/lp0

I've got an error:

bash: /dev/lp0: Access denied

I've tried sudo'ing this command with no success. Also tried to mirror the DOS approach of copying file to LPT1:

cp /etc/hosts /dev/lp0

Again with no success.

Any suggestions that I can try to get this approach to work?

xyzman

Posted 2011-06-24T17:36:59.537

Reputation: 398

You should be able to write to that. Strange! – sinni800 – 2011-06-24T17:43:22.837

Answers

7

I seem to have it figured out. Silly me. While googling examples of lpadmin usage, I've stubled upon this link: http://ubuntuforums.org/showthread.php?t=1437325

Permissions on dev/lp0 were:

c---rw---- 1 root lp 6, 0 2011-06-26 22:47 /dev/lp0

Group lp, from my knowledge, has only the lp user. After I performed

sudo chmod 666 /dev/lp0

the following command started working as intended, making printer to output symbols to paper:

echo "Y helo thar" > /dev/lp0

Well, I suppose that is a nice foolproof against someone accidentally writing to LPT port aside from printing daemon, but still it makes no sense for me, why is it disabled for root?

xyzman

Posted 2011-06-24T17:36:59.537

Reputation: 398

4

Probably the lp daemon (print spooler) has exclusive ownership of /dev/lp. Shutdown the spooler (read up on lpadmin and /usr/bin/disable).

sawdust

Posted 2011-06-24T17:36:59.537

Reputation: 14 697

While your idea is not entirely correct, it made me go and read up on how the printing in Linux works. Thanks. – xyzman – 2011-06-26T19:32:39.457