Re: Need advice: writing a char driver

Michael K. Johnson (johnsonm@nigel.vnet.net)
Tue, 20 Feb 1996 09:53:53 -0500


H. Peter Anvin writes:
>It would be nice, however, if /dev/lp? would work for true
>bidirectional ports, e.g. talking to Laserjet printers.

Unfortunately or fortunately (take your pick), laserjets don't
talk EPP or ECP -- that is, they don't use "true bidirectional"
modes. They just use the old nibble mechanism. There's a
package out there for the 4P's, etc, which acts as a control
panel. I don't recall its name at the moment, but I can look
it up if anyone needs it. It would have the info necessary to
add nibbles-on-the-control-lines bidirectional mode to the lp
driver. It's similar top the way that normal PLIP works.

When I did my original rewrite of the driver, I wanted to add
an EPP mode, but I couldn't find the docs (AMD and Intel didn't
seem to know they existed, and I didn't know who to ask other
than the chip vendors...) and I didn't have an EPP-capable
port to test it with. Now I at least know that the extended
parallel port docs were written by HP and are published by
the IEEE. I'm not sure if I have any extended capability ports
because I don't have any personal use for anything but nibble
mode for talking to my laser printer, but it actually has a
control panel so I don't really even need that. :-)

Getting back to the main point of the original question that
started this thread: the lp driver should detect but not
allocate the I/O ports on startup, and should only allocate
them when it is using them. PLIP and other drivers that
use the hardware should do the same. It's an
allocate-on-open, deallocate-on-close strategy that is
required for sharing resources appropriately, IMHO.

michaelkjohnson