The pa device driver provides an interface to the system's
ISA and PCI parallel
ports via the /dev/lp* special device files.
Depending on the machine type, parallel printer ports may exist
on serial/parallel port adapter cards,
parallel port adapter cards, or the motherboard.
ISA parallel ports on PCs are traditionally
given the names LPT1 (device node name lp0),
LPT2 (lp1), and
LPT3 (lp2).
PCI parallel port device nodes begin at lp3.
ISA and PCI
parallel ports are configured into the system using
the mkdev parallel command.
PCI parallel ports
By default, the system is configured to support up to
two PCI parallel ports. If you want to use
additional parallel ports, you can increase
the default value by running mkdev parallel.
Specify the total number of ports installed on your
system, not the total number of parallel adapters.
For example, if you intend to install a two-port
PCI parallel adapter and a four-port PCI
parallel adapter, you must configure your system
to support six PCI parallel ports.
PCI ports are enumerated at boot time -- the first
port detected is assigned /dev/lp3, the second
/dev/lp4, and so forth.
These device numbers are persistent as long as you do not
change your hardware configuration. If you add, remove,
or alter the placement of parallel adapters within the
PCI bus, device node numbering may be different
when you reboot the system. For example, if you have
a one-port PCI parallel card, and you install
a second one, it is possible that the new adapter would
be enumerated as /dev/lp3 and the original
card, which had been /dev/lp3, would become /dev/lp4.
In this scenario, if you had a printer connected to the original port,
you would need to modify the printer's configuration to take
into account that port's new device node.
ISA parallel ports
The first, second, and third parallel printer ports configured on
a system correspond to the character special files
/dev/lp0, /dev/lp1, and /dev/lp2
respectively.
The lp0 and lp2
files provide access to parallel ports 1 and 2, respectively.
The lp1
file provides access to the parallel port on the monochrome adaptor.
Only one of lp0 and lp1
may be used on a given system.
To access two parallel printers
on a system, use either
lp0 or lp1, and lp2.
The parallel driver accepts all
ioctl(S)
commands documented on
termio(M),
although some of these may not make sense for a line printer.
The crash tt -tpa command can be used to monitor the pa
driver; see
crash(ADM)
for more information.
Minor device numbers
The minor device numbers of the lp special files are used to
control the behavior of the parallel port driver. Three bits
may be set in the minor device number, with the following
effects:
Bit 7
Reset printer on each open.
Bit 6
Force polling, rather than interrupts and polling (as normal).
This setting is provided for situations when the printer appears to be
running slowly as a result of lost interrupts.
Bit 5
Tandy printer translation.
This setting is provided to perform translation for driving Tandy
printers. Firstly, all standard output post-processing is turned off. (This is
equivalent to stty -opost.) Secondly, tabs and formfeeds are expanded
at the driver level. (Tabs are expanded to 8-column tabstops; formfeeds are
expanded to 66 lines per page, using carriage returns.
Line count and printhead position are tracked to enable the driver
to expand tabs and formfeeds correctly.)
Thirdly, the character following a backspace is never translated or acted on
in any way except to output it. (Tabs and formfeeds are not expanded;
returns and newlines do not increment the line count and other
characters do not increment the printhead position.)
This type of behavior is required to support certain Tandy printers. It
is not required in any other circumstances, and should not normally
be used.
Interrupt vectors and I/O port address ranges
The following table shows the interrupt vector numbers (IRQ),
and start and end I/O addresses (SIOA and
EIOA) used by an IBM PC/AT with an
ISA bus:
Parallel port
IRQ
SIOA
EIOA
LPT1
7
0x3bc
0x3be
LPT2
5*
0x278
0x27a
*
ISA machines share IRQ 5 for the second
and subsequent parallel ports.
The next table shows the values for EISA and
MCA architecture machines; note that some
machines allow the parallel port addresses to be reassigned:
Parallel port
IRQ
SIOA
EIOA
LPT1**
7*
0x378
0x37f
LPT2**
5*
0x3bc
0x3be
LPT3
5*
0x278
0x27a
*
MCA machines generally share IRQ 7 for all
parallel ports; some EISA and MCA machines
can assign any interrupt vector.
**
MCA machines and some others swap the default addresses
for LPT1 and LPT2.
If a parallel device fails to interrupt properly, the parallel
driver enters ``poll mode''.
Once interrupts are received from the device, the driver returns to its
original mode.
The parallel driver delays a certain amount of time when a parallel device
is closed. The amount of delay can affect printer performance, but
is necessary to compensate for different sizes of printer buffers and printer
speeds. For example, this command sets the delay on close to 1 second,
specified in tenths of a second:
stty time 10< /dev/lp0
When given from a prompt, this command will only work if the port is open.
It is recommended that a variation of this command be placed in the
interface script used with the parallel device to achieve the same results:
stty time 10 0< &1
The parallel device is usually invoked by
lp(C),
but can be written to directly.
Diagnostics
The following error message may be displayed on the console.
See
messages(M)
for general information about kernel error messages,
including a list of generic device driver errors.
WARNING: parallel: Parallel port (unit=n) not found
A parallel port could not be found.
Limitations
On some machines it is not possible to have more than two parallel
ports configured.
LPT1 is usually the parallel port on the first
serial/parallel adapter, and LPT2 the parallel port on
a monochrome video adapter. However, MCA
architecture machines and some others swap this arrangement.
The
stty(C)
command for output processing is supported on a parallel device.
stty options that have no effect on a parallel device
are ignored and no error messages are displayed.
The standard lp ports,
lp0, lp1, and lp2
send a printer initialization string
the first time the file is opened after the system is booted.
Not all computers have an alternate parallel port slot.
Files
/dev/lp[0-2]?
parallel port character special files with minor numbers 0,1, and 2,
where the ? is optional and may be any one of the following: