LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-17-2010, 03:12 PM   #1
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Rep: Reputation: 51
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?
 
Old 03-17-2010, 05:28 PM   #2
computerius materius
LQ Newbie
 
Registered: May 2008
Posts: 1

Rep: Reputation: 0
I believe the reason for it hanging is that parallel ports require a port pulled low or high like serial DTR pins
 
Old 03-17-2010, 05:34 PM   #3
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
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.
 
Old 03-17-2010, 06:47 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
How about:
Code:
echo "hello" | lp
Where "lp" is the system default printer configured in CUPS.
 
Old 03-18-2010, 06:14 AM   #5
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Original Poster
Rep: Reputation: 51
Quote:
Where "lp" is the system default printer configured in CUPS.
Default printer is configured on USB port. Anyway, there might be no LPT printers configured in CUPS, but i still would need to have things work.

Quote:
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.
Thanks, i'll try this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Connect To /dev/lp0 To Setup Printer Harpo SUSE / openSUSE 4 01-29-2007 12:28 AM
no '/dev/lp0' in 2.6.10 ??? jrch Slackware - Installation 4 03-30-2006 05:16 PM
no /dev/lp0 michael71 Slackware 4 02-18-2006 11:11 AM
Printer problem: Couldn't open /dev/usb/lp0 deepika Linux - General 2 09-08-2003 10:25 AM
Echo /devPrinting doesn't work, echo /usb/lp0 works, Testpage works, Printing doesn't Hegemon Linux - General 3 08-15-2002 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration