[comp.unix.questions] HP LJ Series II

dan@charyb.COM (Dan Mick) (12/01/89)

I'm trying to get an HP LJ II hooked up to my 3/50, and I'm having the 
devil's own time getting it to work.  

After a bit of experimentation, I got the file laserjet-printcap.Z from 
a very old comp.misc article, but that goes molasses-slow, as it calls 
select(0,0,0,0,<1500 usec timeout>) between *each character*.  It's 
really horrid, but if I remove the calls, the LJ loses data in ways 
I can't understand.  I've managed, at least, to turn the timeout down 
to 200 us, but I'm still not happy with the performance.

Also, I really don't understand the two filters given (one raw, one
sorta-formatted) or all of the printcap entries, particularly in the
way some tty flags are set from the printcap entry and some from the
filters.  I can't get any log messages from lpd, either. 

Does anyone have any good results with a LaserJet under any BSD, and/or
SunOS 3.2, and/or can you explain the printcaps and filter stuff below?

lp|lz|laserjet|Hewlett-Packard Laserjet:\
	:lp=/dev/ttyb:sd=/usr/spool/lpd:br#9600:pw#132:pl#60:\

	:xs#060:fc#0177477:\   <- this stuff in particular
 	
        lf=/usr/adm/lpd-errs:\
	:of=/usr/local/bin/hpf:vf=/usr/local/bin/lzcat:rs:
	

An extract from lzcat.c...hpf.c does the same initialization.  My questions
are in the ??? comments.

#include <sgtty.h> 

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

    setbuf(stdout, NULL);
    
    
    /* ??? Okay, maybe there aren't local bit masks in some BSD printcaps..*/
    
    /* Work around to by-pass bug in terminal driver and force LITOUT */
    lbits = LMDMBUF|LLITOUT;
    ioctl(fileno(stdout), TIOCLSET, &lbits);
    
    
    /* ??? but do this stuff twice? */
    
    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	*/
}
-- 
.sig files are idiotic and wasteful.