Link to home
Start Free TrialLog in
Avatar of covellc
covellc

asked on

Linux printing

New, question...

I am having trouble 'cat'ing a file to my printer, and hence can't print anything. I believe my trouble is fundamental problems with the port, I am not looking at deamons or anything yet, I shall get on to that when I can cat to the port.

My printer port is parallel.
My printer is on /dev/lp2.

If I use "tunelp /dev/lp2 -s" I get the following message:
"Status is 95, busy, on-line".

The printer is on-line, but I do not believe it is busy. The busy light is certainly not flashing.

There is nothing on lpq, "no entries"

If I "cat testfile > /dev/lp2" the session hangs and I must use control C to get the promt back.

Please help !!!! Have I got a spool file knocking around blocking up the port ? I don't know...
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Have you enabled a second printer port in the kernel?
Pleas check in /proc/{devices,interrupts}
Avatar of spjuver
spjuver

First thing to check when parallel/serial ports don't like you:
Do you have any other hardware which uses IRQ 3,4,5 or 7??

Soundcard and LAN-cards sometimes like to uses one of these IRQ's.

The command tunelp find the printer but it is busy (weird). The 'cat' command hangs. Sounds like IRQ messup for me...
Avatar of covellc

ASKER

This sounds as though we are heading down the right track !!!

Of course my next question is how can i tell through Linux what irq settings my hardware is using ! I am at work at the moment and shall be looking at this problem at home tonite so a pointer would be great...
A general question...
Linux will figure out which IRQ you are using if you have compiled in support for that hardware.
Ther problem is not that linux not find your irq. The problem is the actual overlap of irq's.

You have to write down on a piece of paper which irq which port have and which irq which card have. A printer and a modem don't really like share the irqs. The same with sound cards. If it is possible move around irqs on the cards. If it is not possible to change irq on your card and you really have modems and printers etc on your ports. You have hit a hardware limitation in the PC-world...

The multi-port cards usually just steele one irq  and share it with many ports. Maybe an idea??

Anyway to find the irq-settings your kernel have will you find by surf'n around in /proc jungle. cat the irq files there....
Depening of which kernel version as later as better.
Avatar of covellc

ASKER

If I cat /proc/interrupts I get the following:

0:       timer
1:       keyboard
2:       cascade
3:      +serial
13:       math error
14:       ide0
15:       ide1

no lp or parrallel......

I have got a sound card, so I have removed it, but to no avail.

Any other ideas ?
You are missing something there. Do you have lp as module??

If you have, what happens if you write 'modprobe lp'.
How does the /proc/interrupts looks like when you cat your file to the lp device??
Have you watched the system boot? If you have printer support
compiled in, not as a module, you should see the kernel recognize all your printer port(s).
You can also pipe dmesg into more (dmesg|more) to review the bootup.
You say the printer is on /dev/lp2, what is on /dev/lp1 and /dev/lp0?.
If you have lp as a module try insmod lp and see if the irq shows up in use and/or the printer starts working. If it does check your kernel config for the auto module load support.
Avatar of covellc

ASKER

Sorry to be such a pain, but I really do appreciate you time...

I did have lp loaded as a module, but I also believe I have it loaded in the kernle !!! dmesg showed two lots of lp1 and lp2 !!
I have removed the module entry from the rc.modules file. Rebooted and now there is only one entry for lp1 and lp2 in dmesg.

Now if I cat proc/interrupts I have an extra interrupt

4:      +serial

This is in addition to the interrupts mentioned in my last comment.

If I try and tunelp /dev/lp2 -s while catting my file I get the message /dev/lp2 Device or resource busy

If I turn the printer off and tunelp I get:

status 79, busy while it is turning off, and

status is 135, ready, error when it is turned off.

The status of /dev/lp1 is 200.

What next ?
Avatar of covellc

ASKER

I am crap ! The 'extra' serial interupt is the modem, I was online while writing the last comment, oops.
Don't care about the serial ports lp-ports is parallel.

I think that you have to clean out every possibility for interference.

Remove every possible card wich use irq 5 or 7 (incl PnP).
Make sure that lp is compiled in the kernel and remove all lp modules.
Put an '/bin/sh' entry in the end of your /etc/rc.d/rc.sysinit file.

Reboot and cat your favorite file to the /dev/lpx device.

If it works then you have an interference somewhere.
If it not works, then you have an interface/driver problem.

If you get the file correctly on your printer. You have to put back things and use tunelp to check. Begin with starting of certain daemons.
Still works? put the most suspected card back first then reboot.

This is an efficient way but demands a lot of time....


Avatar of covellc

ASKER

The latest word...

Right, I have done all you said. I have pulled all the cards. I have changed the device to /dev/lp1 on the card. I have cut loads of stuff out of my rc. files...

I was not sure how to check for lp in the kernel, but what I have found is...

When I boot there is no lp in /proc/devices.

If I do a tunelp then the device lp appears in /proc/devices but it is set to polling.

On boot up there is no entry in /proc/ioports but if I tunelp to use irq 5 it appears. Also it appears in /proc/interrupts on irq 5.

I seem to be winning, BUT cat still hangs when I cat a file to /dev/lp1

So, your last comment says it looks as though I have an interface/driver problem. Any ideas.

PS spjuver reply with a propper answer so I can give you some points (better still, reply to my old outstanding question so I can give you the points !!!!)
Double check on your system which IO buss the parallel port is  on ISA or PCI.
Then, in your BIOS there should be a place to setup your PCI bus interrupts. Often this is set for automatic. Make it manual and do not give irq's 5 and 7 to the PCI bus. That way the parallel port should be guarenteed of the correct irq so the linux driver should work.
If your parallel port is on an ISA card this is imperative to getting it to work.
Avatar of covellc

ASKER

Hooray, I have finally got the printer to print.

Yes, it seems as though I had to wade through the bios setup and manually set the printer address. I have also now moved the printer to the on board parallel port instead of the one on the serial card.

Many thanks to jeffa and spjuver. I have learnt loads about the /proc directory in the last week thanks again.

I want to give you both points, so i need you to answer the question instead of just commenting, please can one of you answer this one and the other my other question, so I can assign the points !

Cheers

Chris...
I'm not interested in the points just happy that everything is working for you...
jeffa, go ahead.
ASKER CERTIFIED SOLUTION
Avatar of jeffa072897
jeffa072897

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of covellc

ASKER

Thanks again for spending so much time on this question, I really appreciate it.