LPTCTL(8) NetBSD Programmer's Manual LPTCTL(8)


manipulate lpt devices


lptctl /dev/device [-d on|off] [-i on|off] [-m standard|ps2|nibble|fast|ecp|epp] [-M ps2|nibble|ecp] [-s] [-r] [...]


lptctl is used to manipulate lpt devices so that a user can change how a printer that is attached to a parallel port works. If no command-argument pairs are specified, the status of the device is printed to standard output using the following format:

dma=[on|off] ieee=[on|off] mode=[standard|nibble|ps2|fast|ecp|epp]

The status information is also output after commands are carried out.


Commands can be specified in any order. The commands are executed as the command line is parsed until the arguments are exhausted or an error occurs. Commands can be repeated with different arguments on the same command line: all are executed as the arguments are parsed and the last successfully executed command will have the lasting effect (if the command changes the device's state).

Available commands are:

-d on | off
Enable or disable DMA. DMA is generally only used when a FIFO is available: setting this option with the 'standard' mode will not affect the operation of the device for example. Fast Centronics and ECP modes should be able to take advantage of DMA, but the details of this depend on the hardware driver below ppbus(4).
-i on | off
Enable or disable the use of IEEE 1284 negotiations during mode changes and channel direction changes.
-m standard | nibble | ps2 | fast | ecp | epp
Set port to use a mode of operation: standard centronics mode (standard), nibble mode, bidirectional mode (ps2), fast centronics mode (fast), enhanced capabilities port mode (ecp), or enhanced parallel port mode (epp).
-M nibble | ps2 | ecp
Set port to use the specified mode to return the device ID string for an IEEE 1284-compliant device. See the -r option.
Read the device ID string for an IEEE 1284-compliant device using the mode set using the -M option. The original device mode is restored when the operation completes.
Scan the port for IEEE 1284 devices. Results of scan will be sent to the system console by the kernel.


lptctl returns 0 on success, and values > 0 on failure: see DIAGNOSTICS.


interrupt-driven printer ports
polled printer ports


To enable DMA, enable IEEE negotiations, and set the mode to Fast Centronics for lpt0:

lptctl /dev/lpt0 -d on -i on -m fast

To disable DMA, disable IEEE negotiations, and set the mode to nibble for lpt1:

lptctl /dev/lpt1 -i off -mode nibble -d off

Note that the order of the arguments affects the outcome: disabling IEEE negotiations before changing the mode means that the change will NOT be negotiated with the device.

Because of the way lptctl parses it's arguments, it is possible to enable/disable DMA in the same command:

/dev/lpa0 -d on -d off


Exit statuses:

one of the arguments to the utility was invalid.
the device special file could not be opened/closed.
ioctl request on the device failed.

Errors are accompanied by diagnostic messages written to standard error.


ioctl(2), lpt(4), ppbus(4)


A similar utility called lptcontrol exists in FreeBSD to control the lpt device. While similar in concept, the implementations are independent.


This man page and the lptctl utility were written by Gary Thorpe <gathorpe@users.sourceforge.net>.


lptctl opens the printer device and causes device initialization if /dev/lpa? or /dev/lpt? are used. Therefore, a printer must be connected and functioning to use this utility or you will have to create a lpt device with an appropriate minor number (see lpt(4) for more details).