Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!amdcad!lll-crg!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.bugs.4bsd Subject: 4.[123]bsd dev/lp hoards final form feed (with fix) Message-ID: <6034@elsie.UUCP> Date: Wed, 26-Feb-86 00:09:12 EST Article-I.D.: elsie.6034 Posted: Wed Feb 26 00:09:12 1986 Date-Received: Fri, 28-Feb-86 21:36:14 EST Organization: NIH-LEC, Bethesda, MD Lines: 69 Keywords: bsd lp Index: sys/vaxuba/lp.c Description: The lp driver will, with certain interfaces and printers (we've got a Printronix 600 ourselves), hold the the final form feed generated by closing the device until the device is reopened. Not a problem for high-print-volume sites; a paper waster at low-volume sites, though (details upon request). Repeat-By: Using the command echo HI > /dev/lp If you've got the problem, the page with the word HI on it will not be feed out of the printer, despite the fact that "lpclose" generated a form feed. Fix: The problem comes about because various parts of the code test sc_outq.c_cc > 0 to see if there's work to do. But if the driver has read a character out of the above queue and was unable to output the character, the driver saves the character away in sc_lpchar. So even if sc_outq.c_cc is zero, there may be work to do. Here are the changes to the 4.1bsd version of lp.c, conditioned on "OLDVERSION." First, a change to "lpintr": ... sc->sc_state |= MOD; #ifdef OLDVERSION if (sc->sc_outq.c_cc > 0 && (lpaddr->lpsr&ERROR)==0) #else if (sc->sc_lpchar >= 0 && (lpaddr->lpsr&ERROR)==0) #endif lpaddr->lpsr |= IENABLE; /* ok and more to do later */ if (n>LPLWAT && sc->sc_outq.c_cc<=LPLWAT && sc->sc_state&ASLP) { sc->sc_state &= ~ASLP; wakeup((caddr_t)sc); /* top half should go on */ } ... There are also two changes to "lptout": ... #ifdef OLDVERSION if ((sc->sc_state&OPEN) == 0) { #else if ((sc->sc_state&OPEN) == 0 && sc->sc_lpchar < 0) { #endif sc->sc_state &= ~TOUT; /* no longer open */ lpaddr->lpsr = 0; return; } #ifdef OLDVERSION if (sc->sc_outq.c_cc && (lpaddr->lpsr&DONE) && (lpaddr->lpsr&ERROR)==0) #else if (sc->sc_lpchar>=0 && (lpaddr->lpsr&DONE) && (lpaddr->lpsr&ERROR)==0) #endif lpintr(LPUNIT(dev)); /* ready to go */ timeout(lptout, (caddr_t)dev, 10*hz); ... -- Bugs is a Warner Brothers trademark. LP may have been a Columbia trademark at one time. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks