Bug 27403

Summary: [lpt] lpt driver doesn't handle flags anymore
Product: Base System Reporter: sperber <sperber>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: jpaetzel
Priority: Normal    
Version: 4.3-RELEASE   
Hardware: Any   
OS: Any   

Description sperber 2001-05-17 09:10:00 UTC
The lpt driver provides historical provision for some options to be
encoded in the minor device number:

#define LP_POS_INIT	0x04	/* if we are a postive init signal */
#define LP_POS_ACK	0x08	/* if we are a positive going ack */
#define LP_NO_PRIME	0x10	/* don't prime the printer at all */
#define LP_PRIMEOPEN	0x20	/* prime on every open */
#define LP_AUTOLF	0x40	/* tell printer to do an automatic lf */
#define LP_BYPASS	0x80	/* bypass  printer ready checks */

(The first two seem to no longer be supported by the code, the rest
is.)

This used to work at least up to FreeBSD 2.2.  Now, using mknod to
create lpt devices with any of these options set, FreeBSD no longer
recognizes the resulting device notes as attached to the driver.
("Device not configured.") My guess is that it used to mask out higher
bits from the minor device number in earlier versions of FreeBSD which
it doesn't do anymore.

There is explicit provision for LP_BYPASS and LP_BYPASS by itself only
for the lpt0.ctl device.

Fix: 

If I've diagnosed the problem right the old way of setting options is
hard to support in the new framework.  There seem to be two ways of
approaching this:

- make the options kernel-configurable

- provide explicit support for NO_PRIME (as for LP_BYPASS) by itself
  and implement ioctls for priming the port and turning on auto
  linefeed.

I'm willing and able to implement either of these, given some guidance
from the maintainers on how to proceed.
How-To-Repeat: 
As root:

mknod /dev/lpt0.autolf c 16 64
cat /dev/null > /dev/lpt0.autolf