*BSD News Article 74389


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!nntp.primenet.com!news.cais.net!news.fc.net!obiwan!bob
From: bob@luke.pmr.com (Bob Willcox)
Subject: Re: Printcap Problems with HP Direct Jet lpd
Sender: news@obiwan.pmr.com (News Subsystem)
Organization: Bob's Place, Austin TX
Message-ID: <DuwtzF.CBC@obiwan.pmr.com>
References: <4ss108$fea@mulga.cs.mu.oz.au> <4ssqp1$5k8@uriah.heep.sax.de>
X-Nntp-Posting-Host: luke.pmr.com
Date: Sun, 21 Jul 1996 20:23:39 GMT
Lines: 105

In article <4ssqp1$5k8@uriah.heep.sax.de>,
J Wunsch <joerg_wunsch@uriah.heep.sax.de> wrote:
>drew@ariel.ucs.unimelb.EDU.AU (Andrew Heath) wrote:
>
>> I have had a problem with a banner pages being constantly printed.
>> It is wasting a huge number of pages and I can't seem to turn it off.
>
>Your printcap file does not help.  You have to turn off banner
>printing in the JetDirect card itself.  (telnet to the card, and ask
>`help' to see the options.)  Alas, some older JetDirect's didn't even
>support turning it off.

However, turning off banner page printing in the jetdirect card
causes other problems (for me, anyway) between lpd and the jetdirect
card.  I spent some time working with HP tech support a couple of
months ago to help them diagnose the problem.  I believe they are
planning to release a new version of the card (may only be a firmware
upgrade, I'm not sure) that is hoped to fix the problem (I am
currently running a beta copy of the new card that seems to work).

The problem that I ran into had to do with printing multiple
postscript files in rapid succession (so that a queue builds up on
the host system) and having the banner page on the jetdirect card
turned off.  Lpd would send the files to the printer as fast as it
could w/o disconnecting from and reconnecting to the printer.
Unfortunately, it appeared that the jetdirect card was neglecting
to do some kind of (necessary) between job re-initialization when
not printing the banner page when in postscript mode (seemed to
work ok in pcl mode).  I put following hack into
usr.sbin/lpr/lpd/printjob.c to force the closing of the connection
between jobs to avoid the problem.

Note that on my system this hack has the side-affect of slowing
down the printing of multiple jobs since the jetdirect card will
not allow the connection for the next job till it has finished with
the current (and, seemingly, timed out).  I reduced the effect of
this by reducing my timeout on the jetdirect card from 90 to 15
seconds.  I now have to be quicker about my changes when telnetting
to the thing.   :-(


-------------------------------- cut here --------------------------------------
Mon Mar 11 23:51:44 CST 1996
This hack will close the connection to the printer between each print job
and will work-around a problem with the HP JetDirect cards getting an illegal
instruction exception when you have banner printing turned off.

Note: This problem with the JetDirect cards seems to only happen reliably on
fast systems.  Luke (currently a P166) fails consistently but obiwan (a P100)
does not.

Index: usr.sbin/lpr/lpd/printjob.c
===================================================================
RCS file: /usr/cvs/FreeBSD/src/usr.sbin/lpr/lpd/printjob.c,v
retrieving revision 1.4.4.2
diff -u -r1.4.4.2 printjob.c
--- printjob.c	1995/10/06 10:30:44	1.4.4.2
+++ printjob.c	1996/03/12 04:41:11
@@ -198,7 +198,6 @@
 		if (fchmod(lfd, stb.st_mode & 0776) < 0)
 			syslog(LOG_ERR, "%s: %s: %m", printer, LO);
 	}
-	openpr();			/* open printer or remote */
 again:
 	/*
 	 * we found something to do now do it --
@@ -210,6 +209,7 @@
 		if (stat(q->q_name, &stb) < 0)
 			continue;
 	restart:
+		openpr();		/* open printer or remote */
 		(void) lseek(lfd, (off_t)pidoff, 0);
 		(void) sprintf(line, "%s\n", q->q_name);
 		i = strlen(line);
@@ -251,7 +251,6 @@
 			(void) close(pfd);	/* close printer */
 			if (ftruncate(lfd, pidoff) < 0)
 				syslog(LOG_WARNING, "%s: %s: %m", printer, LO);
-			openpr();		/* try to reopen printer */
 			goto restart;
 		}
 	}
@@ -274,6 +273,7 @@
 		(void) unlink(tempfile);
 		exit(0);
 	}
+	(void) close(pfd);	/* close printer */
 	goto again;
 }
 
@@ -1228,7 +1228,7 @@
 			setty();
 		pstatus("%s is ready and printing", printer);
 	} else if (RM != NULL) {
-		for (i = 1; ; i = i < 256 ? i << 1 : i) {
+		for (i = 1; ; i = i < 256 ? i++ : i) {
 			resp = -1;
 			pfd = getport(RM);
 			if (pfd >= 0) {
-------------------------------- cut here --------------------------------------
-- 
Bob Willcox	       politics, n:
bob@luke.pmr.com         A strife of interests masquerading as a contest of
Austin, TX               principles.  The conduct of public affairs for private
                         advantage.       -- Ambrose Bierce