/etc/printcap problem

/etc/printcap problem

Post by Erka Koivun » Fri, 09 Jan 1998 04:00:00



I'm trying to get my new workgroup printer (HP LJ4000N) to work.
Data flows and ink sticks to paper like it should but there's
some trouble with invoking a filter with lpr command.

My /etc/printcap entry looks like this:
HP4000N|hp4000n:lp=:sd=/var/spool/lpd/stips3:rm=ip.address.here:\
       :if=/var/spool/lpd/stips3/filter:lf=/var/log/lpd-errs:

And my /var/spool/lpd/stips3/filter looks like this:
#!/bin/sh
/usr/bin/tr -d '\r' | /var/spool/lpd/a2ps -x

The problem is such that when using lpr the data clearly doesn't
go through the filter. If the file doesn't contain ^M:s the printer
doesn't recognise line feeds. Also, the filter should make the
printer to print two pages on one with borders and some header
information.

'a2ps | lpr' works fine -> the problem is either in filter or
in printcap..

We currently have a HP LJ4MP machine connected to LPT1 and it
works fine with an printcap entry like this:
HP4MP|hp4mp:lp=/dev/lp1:sd=/var/spool/lpd/stips2:sh:mx#0:\
        :if=/var/spool/lpd/stips2/filter:lf=/var/log/lpd-errs:

ls -la /var/spool/lpd/stips3/ shows:
drwxrwxr-x   2 root     daemon       1024 Jan  8 11:53 .
drwxrwxr-x   7 root     lp           1024 Jan  6 20:47 ..
-rw-rw---x   1 root     lp              4 Jan  8 11:53 .seq
-rwxr-xr-x   1 root     root           55 Jan  6 20:47 filter
-rw-rw-r--   1 root     daemon         19 Jan  8 11:53 lock
-rw-rw-r--   1 root     daemon         27 Jan  8 11:53 status

Any advice will be appreciated. Also email - but my address needs
some modification:


Erka

 
 
 

/etc/printcap problem

Post by Pablo Sanche » Fri, 09 Jan 1998 04:00:00


Quote:>>>>> "Erka" == Erka Koivunen <Erka.Koivunen.hut.fi> writes:

Erka>
Erka> My /etc/printcap entry looks like this:
Erka> HP4000N|hp4000n:lp=:sd=/var/spool/lpd/stips3:rm=ip.address.here:\
Erka>        :if=/var/spool/lpd/stips3/filter:lf=/var/log/lpd-errs:

Are you sure you're filter is being invoked?  Here's what
I'd do to my filter to ensure this... assuming bourne shell:

DEBUG="N"

if [ $DEBUG = "Y" ] ; then

   set -x

   exec 1>/usr/tmp/lpr-to-lp.log 2>&1

   echo "Called with \\c" > /dev/console

      echo " $i"\\c > /dev/console
   done

   echo > /dev/console
fi

or something to the above...  the reason I ask is that I
recall reading the printcap manual and it says that some
filters get invoked for different types of files.  Perhaps
your file is tickling lpd to want to use another filter...
just a random thought...

The other thing to do is to use strace and to trace lpd and
its child(ren) when you execute the print command to see
what's going on... this always works for me.  Takes the
mystery out of things...
--
Pablo Sanchez              | Ph # (650) 933.3812          Fax # (650) 933.2821

-------------------------------------------------------------------------------
I am accountable for my actions.   http://reality.sgi.com/pablo [ /Sybase_FAQ ]

 
 
 

/etc/printcap problem

Post by Erka Koivun » Wed, 14 Jan 1998 04:00:00


Erka.Koivunen.hut.fi:

Quote:> some trouble with invoking a filter with lpr command.

> My /etc/printcap entry looks like this:
> HP4000N|hp4000n:lp=:sd=/var/spool/lpd/stips3:rm=ip.address.here:\
>        :if=/var/spool/lpd/stips3/filter:lf=/var/log/lpd-errs:
..
> And my /var/spool/lpd/stips3/filter looks like this:
> #!/bin/sh
> /usr/bin/tr -d '\r' | /var/spool/lpd/a2ps -x

Why isn't the filter given in /etc/printcap ever used?

When I do cat|filter|lpr everything works fine. I heard a
rumor that you can't put filter in printcap for network
printer.. Seems like it but is not very logical.

I think I need help with this one.

Erka, modify my email if also sending mail
--
"The purpose of having the sun go low in the evenings, in the summer,
especially in parks, is to make girl's *s bob up and down more
clearly to the eye." -Douglas Adams
http://www.veryComputer.com/

 
 
 

1. lpr and /etc/printcap problem.


Correct!

If you use "rm=" then lpd is designed to ignore most options in
printcap.  This is because options should be set in the printcap on
the machine to which the the printer is physically connected (in other
words the machine indicated by the "rm" field).

This of course is not much use these days now that the "rm" often
points directly to the printer.

Check the printer manual, you can probably pass both bits of
information using the "rp=" option in the printcap.

If not, use cascaded print queues.  (ie. 2 queues the first with *no*
printer and a filter containing "lpr -Psecond", the second having the
"rm" attribute.)

-

 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)

.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/

2. crippling network problem

3. /etc/printcap problem

4. nVidia GeFORCE2 force specific refresh rate?

5. Converting /etc/printcap -> /etc/lp/*

6. Newbie:Linux w/ ASUS SC875

7. ps/1, Lilo, etc etc etc problems w/ instalation

8. Badly place ()'s when using rsh!

9. lpd/lpr broken? (/etc/printcap)

10. Need help with HPDJ720, printing script file and /etc/printcap

11. multi-tray printers and /etc/printcap?

12. psnup in /etc/printcap

13. nprint and /etc/printcap