Operating System - HP-UX
1833780 Members
2886 Online
110063 Solutions
New Discussion

Re: network printers and device files

 
SOLVED
Go to solution
HSW Support
Advisor

network printers and device files

I have setup a printer (HP4050) using jetadmin. I can print to this fine using lp etc and all seems ok.

A third party application needs a device file for selection of an output device ie /dev/ttyxxx etc. How can I select my printer ?. Does it have a device file or is this handled by the LP spooler ?

Example of lpstat command is :

/#lpstat -t
scheduler is running
system default destination: hp4050
device for hp4050: /dev/null
hp4050 accepting requests since Jul 26 10:38
printer hp4050 is idle. enabled since Jul 26 10:38
fence priority : 0
no entries

Why does device show as /dev/null ? I have looked into using lpadmin to specify a device file but this assumes that one exists already.

Any help much appreciated.

Mike
5 REPLIES 5
Tim D Fulford
Honored Contributor
Solution

Re: network printers and device files

The device is /dev/null as your printer is probably a network(ed) printer. If the printer was local on your machine the the device would be /dev/

I'm not too sure if this has answered your question? I think it is related the contents of /var/spool/lp/member/ but am not 100% sure.

Tim
-
MANOJ SRIVASTAVA
Honored Contributor

Re: network printers and device files

Hi Mike

Essentially /dev/null is a null file used for many purposes . One of them is the netwrok printers where in since we have to specify a device for a printer the same is done as /dev/null , but in realtiy it is never used since the hpnp dameon takes over.

In your application you will have to either one of the following :

1. Pipe the output to lp -d < printer name> or lp in case this is a default printer.

2. Or define in the env of the user that lp is lp -d .


Manoj Srivastava
Victor_5
Trusted Contributor

Re: network printers and device files

Hi Mike:

System communicates with the printers through files called device files. HP-UX treats I/O to a printer in the same manner as I/O to a file. In your case, you set up your printer as a network printer, that is why you see the device file is /dev/null. About /dev/ttyxxx, it is for serial devices, i.e. terminal, modem or serial printer.

I am wondering why your third party application only can be send out to a serial device, so try to send it out to a network printer instead, otherwise, probably you have to find another serial printer for your third party application.
Rita C Workman
Honored Contributor

Re: network printers and device files

I don't know if this will help...but....
Sounds like your vendor is doing some very low level coding. I have a similar application (FileNet software) that runs very low level code...it's created some 'challeneges' for me.
As the others mentioned....to this printer your probably not going to hit a /dev file. My guess is that whatever he is running...he is probably using TCP, RPC and API protocols.
My guess is that he would need to set up a print server between the UNIX box and the printer....set this print server up in your hosts file...than direct your print jobs to that print server. You would need this, since if it's low level code, you may need to have your print server interface to format the output properly...

Just a thought, may help you...may not, like I said just a thought,
Rita

A. Clay Stephenson
Acclaimed Contributor

Re: network printers and device files

Hi:

One way you could make this work is via a named pipe.

mknod p /dev/myprinter
chmod 666 /dev/myprinter

then
create a small script, e.g. myprinter.sh
#!/usr/bin/sh
while [ 1 -lt 2 ]
do
lp -dmyprinter < /dev/myprinter > /dev/null 2>&1
done
exit 0

Next execute myprinter.sh

You should then be able to direct the output
of your program to /dev/myprinter.

Clay
If it ain't broke, I can fix that.