Thursday, August 04, 2005

Printer prints, but can't see queue.

Subject: Printer prints, but can't see queue.

Hi,
My printer (an Espon Stylus injet) prints from my Sun (Ultra
80, Solaris 9)
okay, using Ghostscript to convert the postscript to Epson's language. I use the
parallel port on the U80.

Something like

% cat file.ps | lp
works fine and prints okay using Ghostscript and

% cat file.epson | lp -d st850_direct
will put the file directly to the printer.

However, lpq will never show what is in the queue - either of them. This used to
work, but I noticed it failed to work some months ago.

Can anyone give me a clue where to start looking for the problem ?

Leslie Hayward

What do you get from lpstat -t?

sparrow /export/home/davek % lpstat -t
scheduler is running
system default destination: st850_ps
system for _default: sparrow (as printer st850_ps)
device for st850_ps: /dev/ecpp0
device for st850_direct: /dev/ecpp0
_default accepting requests since Sat Nov 2 14:36:53 GMT 2002
st850_ps accepting requests since Sat Nov 2 14:36:53 GMT 2002
st850_direct accepting requests since Sat Nov 2 14:37:29 GMT 2002
printer st850_ps is idle. enabled since Sat Nov 2 14:36:53 GMT 2002. available.
printer st850_direct is idle. enabled since Sat Nov 2 14:37:29 GMT 2002.
available.

But lpq says it can't talk to the print service.

sparrow / # /usr/ucb/lpq
could not talk to print service at sparrow

(I've tried that both as a normal user and as root in the above example).

David, this doesn't answer your question, but you may be able to help me with
mine. I see you've got a printer on the parallel port. How did you configure it?
All my attempts have ended in printless silence, and reliance on the network
printer....

I'm not expert on this and are not 100% convinced it is okay now, but it works
(minus my ability to read what's in the queue) in the single user environment. I
took some of the information on setting up Ghostscript via the web, from an
earlier revision of:
http://cfauvcs5.harvard.edu/Se tGSprinter4Solaris.html
which someone at Sun said was wrong, since my filter was printing to the
parallel port and not to standard output. However, despite this, the queue
worked then. Later I changed things to how someone at Sun said it should be, and
they were better, but the queue which is my present problem was never an issue
until relatively recently (perhaps since I installed Solaris 9).

(Note I did point out to the author of the web page above about this issue with
printing to stdout rather than the port itself. You can see he has made a note
about it, but finds it more troublesome himself.)

Perhaps I should have another read at the documentation myself, since this may
be why my queue is not working.

I don't know if you have a Postscript printer or not. I don't has a Postscript
printer, so I'm not sure how helpful the following is, but I've installed two
queues as you see above. st850_ps goes via Ghostscript, so converts the
Postscript output by 99% of Solaris programs to Epson control commands. The
other queue, st850_direct connects directly to the printer, with no processing.
st850_direct is set up so I can print via Samba from a PC to the printer on the
Sun.

1) To set up the direct queue, with no processing.

# ls -l /dev/ecpp0 lrwxrwxrwx 1 root root 50 Sep 14 17:03
/dev/ecpp0 -> ../devices/pci@1f,4000/ebus@1/ecpp@14,3043bc:ecpp0

# ls -l /devices/pci@1f,4000/ebus@1/ecpp@14,3043bc:ecpp0
crw-rw-rw- 1 root sys 64, 0 Nov 2 20:47
/devices/pci@1f,4000/ebus@1/ecpp@14,3043bc:ecpp0

lpadmin -x st850_direct
lpadmin -p st850_direct -v /dev/ecpp0 -T unknown -I any
enable st850_direct
accept st850_direct

2) To set up the queue, printing via Ghostscript I essentially followed the
instuctions at
http://cfauvcs5.harvard.edu/Se tGSprinter4Solaris.html

I've set up a script for this, which I copied below.
# 1) remove any printer under the name st850_ps
lpadmin -x st850_ps

# 2) define filter description /etc/lp/fd/PS_to_EPSON.fd

# 3) Make ownership correct on filter
chown lp:lp /etc/lp/fd/PStoEPSON.fd

# 4) Define the printer name and the port device the printer will us
# According to the Answerbook, the device to use is /dev/null.
/usr/sbin/lpfilter -f PStoEPSON -F /etc/lp/fd/PStoEPSON.fd

# 5) Register the printer
#/usr/sbin/lpadmin -p st850_ps -v /dev/null -I ESC2
/usr/sbin/lpadmin -p st850_ps -v /dev/ecpp0 -I ESC2

# 6) ENABLE PRINTER
accept st850_ps
enable st850_ps

# 7) DISABLE THE BANNER AND SET SPEED ON
# the parrallel port to 19200 bits/s.
lpadmin -p st850_ps -o "stty=19200" -o nobanner

# 8) MAKE IT THE DEFAULT QUEUE
lpadmin -d st850_ps

# 9) CHECK IT IS OKAY
lpstat -t st850_ps

# 10) Make /dev/ecpp0 writable by anyone if neceessary,
# which is was in my case.
chmod 666 /dev/ecpp0
#Now replace nobanner=no to nobanner=yes in /etc/lp/interfaces/st850_ps
/usr/local/bin/replace 'nobanner="no"' 'nobanner="yes"'
/etc/lp/interfaces/st850_ps

and the filter looks like this:

sparrow /etc/lp # more /etc/lp/fd/PStoEPSON.fd
Input types: postscript
Output types: ESC2
Printer types: any
Printers: any
Filter type: fast
Options: MODES fast = -f
Options: MODES slow = -s
Options: MODES photo = -p
Options: MODES high = -h
Options: MODES normal = -n
Command: /usr/local/bin/ps_to_epson850

I realised I forgot something from what is in the page at
http://cfauvcs5.harvard.edu/Se tGSprinter4Solaris.html
I print via a script, that allows me to set the resolution.

sparrow /etc/lp/fd # more ./PStoEPSON.fd
Input types: postscript
Output types: ESC2
Printer types: any
Printers: any
Filter type: fast
Options: MODES fast = -f
Options: MODES slow = -s
Options: MODES photo = -p
Options: MODES high = -h
Options: MODES normal = -n
Command: /usr/local/bin/ps_to_epson850

The command file /usr/local/bin/ps_to_epson850 has in it:

#!/bin/sh
# this is /usr/local/bin/ps_to_epson850
# default to standard resolution
RES="@stc800p.upp"
# select high resolution when requested
if [ "$1" = "high" ]; then
RES="@stc800ih.upp"
fi
# run gs with print filtering options (writes to stdout)
# OK exec /usr/local/bin/gs -q ${RES} -dBufferSpace=250000000 -sPAPERSIZE=a4
-sOutputFile=- - -c quit
exec /usr/local/bin/psselect -r | /usr/local/bin/gs -q ${RES}
-dBufferSpace=250000000 -sPAPERSIZE=a4 -sOutputFile=- - -c quit

Greg Andrews

Sparrow is the name of the machine you typed the lpstat command on,
and it has in.lpd disabled in its /etc/inetd.conf file, or you have
the old TCP listeners interfering with inetd binding to the printer
port.

To find out if the old TCP listeners are running, type:

pmadm -l -p tcp

To delete them when they're running, type:

pmadm -r -p tcp -s lpd
pmadm -r -p tcp -s lp
pmadm -r -p tcp -s 0 <-- that's the number zero

-Greg
--

The parallel port device depends on which server/workstation you have.
How well printing works depends on the make/model printer you have.

Can you supply those two bits of information? The version of Solaris
you're using would also be nice to know...


Thanks a lot Greg, I had indeed commented out:

printer stream tcp6 nowait root /usr/lib/print/in.lpd in.lpd

in /etc/inetd.conf

I tried commenting out what I could for security reasons and obviously went one
too far. I think I checked before that printing was still working okay after
commenting the line out. Clearly I did not go as far as to check that one could
see the queue.

Lpstat could see the queue. It was just /usr/ucb/lpq that couldn't.
Lpstat knows it can talk to lpsched via lpsched's FIFO (aka "named
pipe" in the filesystem. /usr/ucb/lpq thinks it must make a network
connection and talk to in.lpd to get the status.

I would suggest switching from the BSD commands (lpr, lpq, lpc, lprm)
to the SVR4 commands (lp, enable/disable/accept/reject, lpstat, cancel).
The only SVR4 command that needs lpd to be running is cancel.

-Greg
--

0 Comments:

Post a Comment

<< Home