Subject: Printing (closure?) [addendum]
To: None <netbsd-users@netbsd.org>
From: Richard Rauch <rauch@eecs.ukans.edu>
List: netbsd-users
Date: 03/08/1999 09:13:19
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---310298026-1836659685-920905999=:14962
Content-Type: TEXT/PLAIN; charset=US-ASCII
Brett Slager had a follow-up which he emailed to me privately, unsure if
the content had already been discussed. To my knowledge, it hadn't passed
through the conversation, and is certainly worth including.
The short of it is: The default lpt?/lpa? devices initialize the port
(minor flag 64 controls this; see lpt(4)), with the default MAKEDEV. So,
when a new parallel-port print-job starts up, the printer is
reinitialized, damaging/ruining both the completing & new print-jobs.
See Brett's pr 7101 in the NetBSD bug report database. (The two that I
filed yesterday are 7099 and 7100, relating to lpr & lprm.)
---
The long of it:
This contradicts, and corrects, my assumption that GhostScript was
emitting ``agressive'' printer-reset codes. (I probably should have
actually examined the GhostScript output stream, or read the appropriate
sources---I _do_ have the LQ-850 printer manual, and could readily have
determined the meanings of the codes; I was lazy; mea culpa.)
The FIX: Make a new set of device nodes with the ``no prime'' option
(minor flag 64) set, and direct any parallel printers to use this. Using
/dev/MAKEDEV as a model, I added an entry to /dev/MAKDEV.local which
defines /dev/lptnp? and /dev/lpanp?, where ``?'' is in {0,1,2}. These are
modeled after the lpt? and lpa? devices in MAKEDEV, with 64 added to the
minor number to turn off the reset pin. I offer my /dev/MAKEDEV.local at
the end, without any promises of correctness. ``I am only an egg.''
(Brett dubbed his lpt?np and lpa?np, for reference. As far as I know, the
name makes no difference, and I prefered to have the device-unit trail the
name, rather than having the name prefixes match as closely as possible.)
After that, redirect your /etc/printcap entry (or entries) to use the new
parallel device node(s).
I now have my printer's buffer re-enabled (though it makes no difference
in performance, that I can see). Brett's solution is cleaner, however,
for at least two reasons:
A) It is independant of the printer---it may not be that every printer has
its buffer as readily disabled as my LQ-850.
B) I do not know for certain what would happen if a printer-reset occurs
while the printer is in the middle of printing a line (_that_ much of
a buffer may be impossible to avoid). Some printers may not even
have a concept of a ``line''. I assume that at least some
printers would always have the danger of being reset if the parallel
port is allowed to send a reset everytime it is opened.
Of course, this little exercise has taught me one other thing: If I ever
need to do a printer-reset, I should be able to do so by simply opening &
closing /dev/lpt0. That is a potentially valuable tidbit.
I will MIME-attach my MAKEDEV.local; I'm sure that if I did anything
abominable, someone will correct me. (But, for that, it may be best to
start a new thread on MAKEDEV...) Naturally, I include my MAKEDEV.local
purely for reference; you are encouraged to thoughtfully modify your own
MAKEDEV.local rather than rely upon me...(^&
After running MAKEDEV.local with `all', I get the following:
# ls -l /dev/lp*
crw------- 1 root wheel 16, 128 Jan 27 13:50 /dev/lpa0
crw------- 1 root wheel 16, 129 Jan 27 13:50 /dev/lpa1
crw------- 1 root wheel 16, 130 Jan 27 13:50 /dev/lpa2
crw------- 1 root wheel 16, 192 Mar 7 17:25 /dev/lpanp0
crw------- 1 root wheel 16, 193 Mar 7 17:25 /dev/lpanp1
crw------- 1 root wheel 16, 194 Mar 7 17:25 /dev/lpanp2
crw------- 1 root wheel 16, 0 Mar 7 13:54 /dev/lpt0
crw------- 1 root wheel 16, 1 Jan 27 13:50 /dev/lpt1
crw------- 1 root wheel 16, 2 Jan 27 13:50 /dev/lpt2
crw------- 1 root wheel 16, 64 Mar 7 18:15 /dev/lptnp0
crw------- 1 root wheel 16, 65 Mar 7 17:25 /dev/lptnp1
crw------- 1 root wheel 16, 66 Mar 7 17:25 /dev/lptnp2
(Again, the ``np'' is for ``No Prime'', the version that does NOT reset my
parallel device whenever the port is opened.)
...I really don't need all of those; I just use /dev/lptnp0. But it
mirrors the MAKEDEV constructions. Symmetry tends to make things simpler
for me to understand.
Thanks again to Brett for pointing this out.
"I probably don't know what I'm talking about." --rauch@eecs.ukans.edu
---310298026-1836659685-920905999=:14962
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="MAKEDEV.local"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.04.9903080913190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