SUMMARY: PRINTCAP for HPII LaserJet on IPC

From: Claudia McIntyre (claudia@nephthys.c-cs.siu.edu)
Date: Sat Mar 14 1992 - 03:31:51 CST


Thanks for helping me solve our printing problem!!

I am using solution #1 below. I have included the other responses that I
received (I did not test these yet).

If more responses are received, I`ll summarize....after my vacation next week
%*)

Thanks again,
Claudia

****************************************
1)

This is the printcap entry that we use. I have an HPLaser jet II
running serial off ttyb on my sparc 1.

halifax|HALIFAX:\
        :lp=/dev/ttyb:rw:sc:sh:mx#0:\
        :br#9600:fc#0377777:fs#0004001:xs#040150:\
        :ms=opost,cs8,onlcr,-ocrnl,-onocr,-onlret,-tabs,-parenb:\
        :sd=/usr/spool/lpd/halifax:lf=/usr/spool/lpd/halifax/log:\
        :cf=/usr/spool/lpd/halifax/wpcf:

I hope this is of some help. We also had trouble with the cable configuration.
It took us some time to work that out. Sorry I don't have that info. available
right now. If I find it I will send it to you.

---------------------------------------------------------------------------

Greg DeDera |
Martin Marietta Canaveral Ops. |
Phone # : (407) 853-7464 |
FAX # : (407) 853-2739 |
Mail Stop : EA110 |
E-mail : greg@matterhorn.mmc.cap.com |

---------------------------------------------------------------------------
2)

I can give you two printcap entrys along with their output filters,
but I must warn you that we have had some troubles with both setups.
I will try to summarize them. I am very interested in your summary,
as I am looking for a better setup which eliminates the problems
with the entrys we currently use.

-------------------------

Setup number one (I don't know where this came from):

For text -

lp1|sunroom|laserjet|HP Laserjet Plus:\
        :lp=/dev/ttya:sd=/var/spool/lpd:br#19200:ms=cs8,nl:\
        :tr=^[E:fc#06000:of=/usr/lib/of:lf=/var/adm/lpd-errs:

"raw", for graphics files (no output filter) -

lp2|rsunroom|laserjet|HP Laserjet Plus:\
        :lp=/dev/ttya:sd=/var/spool/lpd:br#19200:ms=cs8,nl:\
        :tr=^[E:fc#06000:lf=/var/adm/lpd-errs:

---------------------------

Notes on this setup:

Seems to work for all configurations (more on this later), but one
has to remember not to send graphics (bitmap) jobs to the entry
with the text filter, as it will tie the print spooler in knots.
The only way to recover from this condition is to re-start the
printer daemon with lpc. If you want to use this entry I
will have to ftp the "/usr/lib/of" text filter to you, as all I
have is the executable for it. Let me know if you want it.

There was one very irritating problem with this setup; It spits
out a blank page after every job. We were wasting so much paper
because if this that I went searching for a better setup. I found
the entry below on uunet.uu.net (anonymous ftp).

-----------------------------
 
Setup number two (from uunet):

lp|zsunroom|laserjetz|Hewlett-Packard Laserjet:\
        :lp=/dev/ttya:sd=/var/spool/lpd:br#19200:pw#132:pl#60:\
        :xs#060:fc#0177477:lf=/var/adm/lpd-errs:if=/etc/hpf:\
        :of=/etc/hpf:vf=/etc/lzcat:rs:tr=^[E:ms=cs8,nl:

This comes with text and graphics filters (specify graphics jobs
with the "-z" option of lpr):

Note: compile these as c programs

text filter hpf -

----------------------------

#include "stdio.h"
#include <signal.h>

int nomap = 0, is_of = 1;

main(ac, av)
int ac;
char **av;
{
    while(ac > 1 && av[1][0] == '-')
    {
        switch(av[1][1])
        {
            case 'c':
                nomap = 1;
                break;
            case 'n': case 'h':
                is_of = 0;
                break;
            default: break;
        }
        ac--;
        av++;
    }

    lzinit();
    hpcat();
    exit(0);
}

#include <sgtty.h>

lzinit()
{
    struct sgttyb nbuf;
    unsigned long lbits;

    setbuf(stdout, NULL);
    /* Work around to by-pass bug in terminal driver and force LITOUT */
    lbits = LMDMBUF|LLITOUT;
    ioctl(fileno(stdout), TIOCLSET, &lbits);
    ioctl(fileno(stdout), TIOCGETP, &nbuf);
    nbuf.sg_flags &= ~(ECHO|XTABS|CRMOD); /* While we're at it, set the mode */
    ioctl(fileno(stdout), TIOCSETP, &nbuf);

    fputs("\033&k3G", stdout); /* Set device to sane mode */
}

hpcat()
{
    register int c, cnt = 0;

    while((c = getchar()) != EOF)
    {

        if(c == '\t')
        {
            do {
                putchar(' ');
                cnt++;
            } while(cnt%8 != 0);
        }
        else if(is_of && c == '\031')
        {
            if(getchar() == '\001') kill(getpid(), SIGSTOP);
        }
        else
        {
            putchar(c);
            if(c == '\f' || c == '\n')
            {
                cnt = 0;
            }
            else cnt++;
        }
    }
}

#include <sys/time.h>

struct timeval tm = {0, 1500};

delay()
{
    select(0, 0, 0, 0, &tm);
}

/* Old version, hope to use again later
#include <sys/time.h>
#include <signal.h>

int wakeup;

void nullfunc(){
    wakeup = 1;
}

struct itimerval tm = {{0, 0}, {0, 1500}};

delay()
{

    void nullfunc();

    signal(SIGALRM, nullfunc);
    wakeup = 0;
    if(setitimer(ITIMER_REAL, &tm, NULL)) exit(1);
    while(wakeup == 0) sigpause(0);
}
*/

----------------------------

graphics filter lzcat -

----------------------------

#include "stdio.h"

int nomap = 0;

main(ac, av)
int ac;
char **av;
{

    lzinit();
    lzcat();
    exit(0);
}

#include <sgtty.h>

lzinit()
{
    struct sgttyb nbuf;
    unsigned long lbits;

    setbuf(stdout, NULL);
    /* Work around to by-pass bug in terminal driver and force LITOUT */
    lbits = LMDMBUF|LLITOUT;
    ioctl(fileno(stdout), TIOCLSET, &lbits);
    ioctl(fileno(stdout), TIOCGETP, &nbuf);
    nbuf.sg_flags &= ~(ECHO|XTABS|CRMOD); /* While we're at it, set the mode */
    ioctl(fileno(stdout), TIOCSETP, &nbuf);

    fputs("\033&k3G", stdout); /* Set device to sane mode */
}

lzcat()
{
    register int c;

    while((c = getchar()) != EOF)
    {
        putchar(c);
    }
}

-----------------------

Notes on this setup:

This setup eliminated the problem with spitting out blank pages
that the first setup had and seems to work very well for print
jobs scheduled on the sun (we use it as the default). However,
we have many IBM PC's here who schedule print jobs through the
Suns using PS-NFS software. The above configuration does not work
AT ALL for this purpose. We had to keep the old (setup #1) entrys
around for the PC's to use. This makes for a big and messy printcap
file and creates a lot of confusion for people trying to figure out
which printcap entry is the correct one to use. There is one other
problem with this setup. If you string together multiple files
to lpr, the filter concatenates them together so there is no page
break between files.

------------------------

Finally, there is a generic problem with the Sun print spooler
which affects both these setups in a very nasty way. Note that
both setups send a "trailer string" to reset the printer
after a job is finished (tr=^[E - sends a control E). The sun
print spooler does NOT send this character between print jobs
if they stack up in a queue. The result of this is that if a
mixture of graphics and text jobs stack up the the queue, the
jobs can get "mixed together" as the printer will not reset
between them. This turns both jobs into useless garbage and both
have to be re-sent. The way we avoid this problem is to always
send a header page before every job. Sending a header page forces
the printer to reset between jobs, but brings us back to the old
problem of wasting paper !!!

So ... if someone sends you a setup which fixes both these
problems I would LOVE to try it here. Otherwise, the entrys
above should basically work. Note that both these setups seem
to work for laserjet series I, II, III and IIIp.

Let me know how it goes ...

Mike Titus
MIT Haystack Observatory
Westford, MA 01886
Tel. (508) 692-4764
internet mail address:
mike@wells.haystack.edu
--------------------------------------------------------------------
3)

        The following entries work. One is for a public domain
driver for TeX originally designed for PC's. I can send you
that if you want it. I am afraid I can't provide you with Transcript
type software.

# HPLaserJet IIP to be used with TeX driver
hptex|ljtex:\
        :br#9600:fc#177777:fs#06021:lf=/var/spool/lj/lj-log:lp=/dev/ttya:\
        :xs#00040:ms=ixon:mx#0:sh:rw:sd=/var/spool/lj:af=/var/adm/lj.acct:
# :if=/usr/local/lib/postscript/ifilter.acct:\
# :df=/usr/local/lib/postscript/dfilter.acct:\
# :vf=/usr/local/lib/postscript/vfilter:
#
# HP HPLaserJet IIP for straight text
lp|hp|lj|laserjet:\
         :br#9600:\
         :fc#0377777:fs#0004001:xs#040150:\
         :ms=opost,cs8,onlcr,-ocrnl,-onocr,-onlret,-tabs,-parenb:\
         :lf=/var/spool/lj/lj-log:\
         :lp=/dev/ttya:\
         :mx#10000:\
         :sc:\
         :sd=/var/spool/lj:\
         :sh:

Leonard Evens len@math.nwu.edu 708-491-5537
Dept. of Mathematics, Northwestern Univ., Evanston, IL 60208



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:38 CDT