echo > /dev/lp0 hangs when no printer is connected
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
echo > /dev/lp0 hangs when no printer is connected
I need to output a byte to LPT port. For this there's an option to program I/O ports directly (with ioperm & outb), but only if LPT port is a standard PC one (ports 0x378, 0x278, etc.). But i need a 'portable' way of doing this, i.e. which would also work on such interfaces as USB2LPT. I guess these adaptors will also have /dev/lp[0-9]* interface (am i right?). Here's what i get currently:
$ echo 1 > /dev/lp0
^C
I.e. i have to use Ctrl+C because 'echo' never exits. When i had a printer connected to LPT, this did work.
So, how can i output some data in portable way, without I/O ports programming and hangs described above?
There are several control signals at the parallel port. They control whether there are errors, the printer is out of paper, is ready, ... By default the parallel port driver waits for the printer to be ready and thus waits forever. You can set several parameters with the tunelp command.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.