Linux - NewbieThis 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
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.
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.
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!
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.
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.
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.
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?
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?
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
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.
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?
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.
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.