LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-12-2019, 12:22 PM   #1
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Rep: Reputation: Disabled
Printer parallel port problem


Hello,
I am new to Linux so I have a lot of doubts every time I want to do anything. Linxquestions.org has been of great help to solve many ot these doubts. Therefore I would like to begin my post by writing a big thanks to all the contributors here.
Now I am stuck with the following problem.
System debian 4.4.5-8. (I know is very old but is used in a industrial pc with an specific program and I cannot update it)
I want to print a file by sending it directly to the printer by using the command cat.
Printer is connected to the parallel port and is a small lable printer model micra.

When I type
cat Eti.prn > /dev/lp0
The prompt blinks and nothing happens. I have to type ctrl C to be able to type more commands.
If I send the file from the terminal where the industrial program is running the printer prints the label perfectly well therefore I disregard any problem related to cables, printer settings or syntax in the file.
I have checked permissions and are as follows:

crw-rw---- 1 root lp 6, 0 jan 11 14:03 /dev/lp0 ( /dev/lp0 in yellow )
I log in as root

I would like to understand why is not working command cat so any hints to troubleshoot this will be welcome.
 
Old 01-12-2019, 07:09 PM   #2
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 3,840

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
Welcome to LinuxQuestions.org. First question - Are you sure that /dev/lp0 is the correct device node for communicating with the printer?
 
Old 01-13-2019, 04:35 AM   #3
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thank you for answering.
No. I’m not sure.
In /dev Only find lp0 and parport0 as possible names for the parallel port.
How could I find it for sure?
Please note that I am really new to linux so maybe I am missing very elementary things!
 
Old 01-13-2019, 05:03 AM   #4
ehartman
Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 951

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Quote:
Originally Posted by 31416 View Post
cat Eti.prn > /dev/lp0
The prompt blinks and nothing happens. I have to type ctrl C to be able to type more commands.
If I send the file from the terminal where the industrial program is running the printer prints the label perfectly well therefore I disregard any problem related to cables, printer settings or syntax in the file.
I have checked permissions and are as follows:

crw-rw---- 1 root lp 6, 0 jan 11 14:03 /dev/lp0 ( /dev/lp0 in yellow )
I log in as root
Normally the printer port (and the parallel port too) are owned exclusively by the printer subsystem (most often CUPS - the Common Unix Printing System) which runs under group "lp", which has a writing permission TO the /dev/lp0 device.
When CUPS has been setup correctly you print by using the command lp (or optionally lpr) instead of accessing the printer directly. See the man page, but what does
Code:
lp Eti.prn
do?
It could also be possible that your industrial program contains its own printing subsystem and has an exclusive lock ON the device file.
 
Old 01-14-2019, 02:06 AM   #5
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ehartman View Post
Normally the printer port (and the parallel port too) are owned exclusively by the printer subsystem (most often CUPS - the Common Unix Printing System) which runs under group "lp", which has a writing permission TO the /dev/lp0 device.
When CUPS has been setup correctly you print by using the command lp (or optionally lpr) instead of accessing the printer directly. See the man page, but what does
Code:
lp Eti.prn
do?
it gives:
-bash: lpr: command not found
or
-bash: lp: command not found

does this means that CUPS is not installed?

Quote:
It could also be possible that your industrial program contains its own printing subsystem and has an exclusive lock ON the device file.
Is there any way to know this for sure?
 
Old 01-14-2019, 02:16 AM   #6
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 3,840

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
Check /var/spool/lpd. Is there a lock file? (eg lpd.lock)
 
Old 01-14-2019, 02:20 AM   #7
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 3,840

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
Quote:
it gives:
-bash: lpr: command not found
or
-bash: lp: command not found

does this means that CUPS is not installed?
Yes, it may well be that CUPS is not installed. These utilities are part of 'cups-client'. I guess the legacy application is just writing to the device node directly perhaps.
 
Old 01-14-2019, 02:38 AM   #8
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Check /var/spool/lpd. Is there a lock file? (eg lpd.lock)
There is not such a directory.
ls /var gives:
log run
 
Old 01-14-2019, 02:49 AM   #9
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 3,840

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
Then I guess we can exclude the device file lock (unless there's something I'm missing here).

You mentioned
Quote:
Code:
cat Eti.prn > /dev/lp0
The prompt blinks and nothing happens. I have to type ctrl C to be able to type more commands.
Is the .prn file valid? I can only speculate here, but perhaps it is missing some essential formatting codes, or is incomplete in some other way? (We can only take your word for this of course.)

A long shot, but is the printer enumerated via the following?
Code:
cat /proc/sys/dev/parport/parport*/autoprobe*
 
Old 01-14-2019, 03:17 AM   #10
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 3,840

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
I forgot that you had mentioned that when the file is sent via the application, it prints ok. I'm speculating that perhaps it sends a command to actually invoke the printing. You may be able to examine the file (hex editor?), and perhaps check the commands contained in it. Do you have access to a user manual (with label printer commands) for the printer in question?
 
Old 01-14-2019, 04:03 AM   #11
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post

Is the .prn file valid? I can only speculate here, but perhaps it is missing some essential formatting codes, or is incomplete in some other way? (We can only take your word for this of course.)

A long shot, but is the printer enumerated via the following?
Code:
cat /proc/sys/dev/parport/parport*/autoprobe*
Under /proc/sys/dev/parport/parport0/ there are autoprobe, autoprobe0, autoprobe1 … autoprobe3 all of them seems to be empty. when doing
Code:
cat /proc/sys/dev/parport/parport*/autoprobe*
nothing happens.


Quote:
Originally Posted by ferrari View Post

Is the .prn file valid? I can only speculate here, but perhaps it is missing some essential formatting codes, or is incomplete in some other way? (We can only take your word for this of course.)
I think the .prn is valid. It is generated by the editor software of the printer manufacturer. Furthermore, when I send the file via the industrial program, it prints. In order to do this before I use the .prn file from the industrial program I need to edit it by changing the file name, adding a header and a eof sign and a text in front of each line. This is a requirement from the industrial program and this way you can use any file from any printer manufacturer.

Quote:
I forgot that you had mentioned that when the file is sent via the application, it prints ok. I'm speculating that perhaps it sends a command to actually invoke the printing. You may be able to examine the file (hex editor?), and perhaps check the commands contained in it. Do you have access to a user manual (with label printer commands) for the printer in question?
Yes I have access to the manual and I can edit via notepad ++ the file. As stated before, the file is generated by the printer´s manufacturer editing software.
I´ve checked the .prn file opening it in notepad ++ and seems to follow all the rules the manual indicates.
 
Old 01-14-2019, 09:40 AM   #12
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Original Poster
Rep: Reputation: Disabled
Just to make sure the file Eti.prn is ok, I used al old pc with xp and parallel port and from DOS
Code:
copy eti.prn lpt1:
prints the label.
Therefore, I am sure the printer understands Eti.prn
 
Old 01-14-2019, 10:38 AM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,025

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
My parallel port printers died many years ago and I don't remember where I put my parallel port loop back connector so I can't confirm if everything still works anymore. However, just as a frame of reference the same thing happens when I try catting a file to an unconnected printer port i.e the command "hangs" until I cancel via ctrl-c. All my autoprobe are empty too but the irq is 7 which is valid for lp0 and the devices sub directory does contain active.

Do you have more then one printer port on your industrial computer? Are you sure you are using the correct printer device?
 
Old 01-14-2019, 11:13 AM   #14
31416
LQ Newbie
 
Registered: Jan 2019
Location: Spain
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Do you have more then one printer port on your industrial computer?
Hello, thanks for answering
The computer has only one physical parallel port. Besides, there are serial ports, usb ports, ...
Quote:
Are you sure you are using the correct printer device?
I don’t know what are you refering to by “using the correct printer device”. I do know the printer is connected to the external physical parallel centronics connector. From what I read it is supposed to be refered in Linux as lp0. I don’t know much more than that.
By the way, I cat to /dev/lp0 Could it be possible that this parallel connector appears in linux in any other directory ?
For me it is important to learn how the printing process works and how to troubleshoot it.
 
Old 01-14-2019, 11:39 AM   #15
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 3,840

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
Quote:
By the way, I cat to /dev/lp0 Could it be possible that this parallel connector appears in linux in any other directory ?
For me it is important to learn how the printing process works and how to troubleshoot it.
Some typical diagnostic approaches you could do

1) Examine kernel outut relating to a parport or similar...
Code:
dmesg ¦ grep par
Code:
dmesg| egrep "par|lp"
2) Examine the kernel's device tree in /proc/sys/dev/parport....
Code:
ls -l /proc/sys/dev/parport/parport*/autoprobe*
Which is why I suggested probing for printer hardware already with
Code:
cat /proc/sys/dev/parport/parport*/autoprobe*
or
Code:
sudo cat /proc/sys/dev/parport/parport*/autoprobe*
3) Finally if you had CUPS or even lprng (minimal *nix-style printing system) installed, you could could make use of lpinfo to see if a printer is detected with
Code:
lpinfo -v
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Nvidia and ARM: It's a parallel, parallel, parallel world LXer Syndicated Linux News 0 03-21-2013 06:10 PM
[SOLVED] Executing a command in parallel | GNU parallel or xargs the_gripmaster AIX 3 05-08-2012 07:41 AM
how can I install a printer on the parallel port? the printer is a Epson LX-2170. atvidal Linux - Newbie 6 05-25-2010 02:01 AM
printer modules not loaded; parallel printer doesn't work blinux1 Linux - Newbie 7 06-24-2004 09:59 PM
Parallel port and printer Xreagan Linux - Newbie 2 09-04-2002 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:18 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration