From: wolf@dentaro.GUN.de (Wolfgang Stanglmeier)
Subject: replacement for lpt.c without interrupts
Organization: Colognists, Germany
Date: Sun, 6 Sep 1992 14:37:03 GMT

I hacked the 386bsd LPT-driver to work without interrupts.
The busy loop timeout value adapts automatically to
the printer and system speed.

It should be a full replacement for the standard driver.

This driver keeps my printer busy without slowing down the system.
[I remember the 90% system time when printing hppcl graphic files
 with the ix/386 lpt-driver WITH interrupts]

The driver supports up to 4 printers.
The minor number is interpreted as follows:

	D D P E - - # #

DD:	Debug,	00: no
		01: statistical data when closing device
		10: statistical data for every write call
		11: lots of silly data

P:	Prime on open.

E:	Errormessage.
		Logs "no paper", "offline", "printer error" conditions
		to the console.

##:	Device,	0: lpt0
		1: lpt1
		2: lpt2		(on display adapter)

This driver uses the ideas of Piercarlo Grandis polling printer driver.

begin 640 lpt.c.Z
M'YV0+U0H`*$"Q)`W</+(27,&#1T0*,:D`!$C1PX8(*ZD8<,F39@V((RX`*'D
M34<Z>EB`H%*&39DF=>:4&5@P"$<0"QO2F8.SC$PY=LJ0<4&3)@@I0M/,H;-0
M3!TZ:=ZX`1'&#1D0,<N`2#-USILZ<L9HK7I5#-<P<O*`,/-&3ILY*N^DH8,&
M1%L0<NE^I6.TS1LR:<RD&1,&JE25:+7"*>-V+AVA(.#(>6,G#1G(=`N#H*N5
M+<<W<MV<`3%&*F##;N8830RB31DZ.HS&&(D4\-*F3Z.FMFL&A%>P8DG_U=HF
MYD,YK\-PW8QFK!C*6DLGS.G0*(CK;MY`%:N2KE(0'9?R%FYUKFZ>9)EW-LD&
M--?1ML>P4>Y:#E&"(&303GH[C5/4/"UGEAMHJ<666ZT9UY-D?]41'&=4/1>4
M<-,Q5!U^UX&0W79E=(?&=^$]]$9OI94'(%56J;<6>^Z)!D)\\Z51WU93<6;=
M=62\,48=KKE!1V&ZH4C&"W=IUYP<K17&F$=L\,1@99==E5==$-K&E'^Y275?
M03.,9!,;5)$1E!Q0S?%>DH\M%$:3K97AHVYGFE%&86#Y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