| 1 |
'\" t |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
.\" |
| 6 |
.TH lp 4 2025-09-21 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
lp \- line printer devices |
| 9 |
.SH SYNOPSIS |
| 10 |
.nf |
| 11 |
.B #include <linux/lp.h> |
| 12 |
.fi |
| 13 |
.SH CONFIGURATION |
| 14 |
.BR lp [0\[en]2] |
| 15 |
are character devices for the parallel line printers; |
| 16 |
they have major number 6 and minor number 0\[en]2. |
| 17 |
The minor numbers |
| 18 |
correspond to the printer port base addresses 0x03bc, 0x0378, and 0x0278. |
| 19 |
Usually they have mode 220 and are owned by user |
| 20 |
.I root |
| 21 |
and group |
| 22 |
.IR lp . |
| 23 |
You can use printer ports either with polling or with interrupts. |
| 24 |
Interrupts are recommended when high traffic is expected, for example, |
| 25 |
for laser printers. |
| 26 |
For typical dot matrix printers, polling will usually be enough. |
| 27 |
The default is polling. |
| 28 |
.SH DESCRIPTION |
| 29 |
The following |
| 30 |
.BR ioctl (2) |
| 31 |
calls are supported: |
| 32 |
.TP |
| 33 |
.BR "int ioctl(int " fd ", LPTIME, int " arg ) |
| 34 |
Sets the amount of time that the driver sleeps before rechecking the printer |
| 35 |
when the printer's buffer appears to be filled to |
| 36 |
.IR arg . |
| 37 |
If you have a fast printer, decrease this number; |
| 38 |
if you have a slow printer, then increase it. |
| 39 |
This is in hundredths of a second, the default 2 |
| 40 |
being 0.02 seconds. |
| 41 |
It influences only the polling driver. |
| 42 |
.TP |
| 43 |
.BR "int ioctl(int " fd ", LPCHAR, int " arg ) |
| 44 |
Sets the maximum number of busy-wait iterations which the polling driver does |
| 45 |
while waiting for the printer to get ready for receiving a character to |
| 46 |
.IR arg . |
| 47 |
If printing is too slow, |
| 48 |
increase this number; |
| 49 |
if the system gets too slow, |
| 50 |
decrease this number. |
| 51 |
The default is 1000. |
| 52 |
It influences only the polling driver. |
| 53 |
.TP |
| 54 |
.BR "int ioctl(int " fd ", LPABORT, int " arg ) |
| 55 |
If |
| 56 |
.I arg |
| 57 |
is 0, the printer driver will retry on errors, otherwise |
| 58 |
it will abort. |
| 59 |
The default is 0. |
| 60 |
.TP |
| 61 |
.BR "int ioctl(int " fd ", LPABORTOPEN, int " arg ) |
| 62 |
If |
| 63 |
.I arg |
| 64 |
is 0, |
| 65 |
.BR open (2) |
| 66 |
will be aborted on error, otherwise error will be ignored. |
| 67 |
The default is to ignore it. |
| 68 |
.TP |
| 69 |
.BR "int ioctl(int " fd ", LPCAREFUL, int " arg ) |
| 70 |
If |
| 71 |
.I arg |
| 72 |
is 0, |
| 73 |
then the out-of-paper, offline, and error signals |
| 74 |
are required to be false on all writes; |
| 75 |
otherwise, |
| 76 |
they are ignored. |
| 77 |
The default is to ignore them. |
| 78 |
.TP |
| 79 |
.BR "int ioctl(int " fd ", LPWAIT, int " arg ) |
| 80 |
Sets the number of busy waiting iterations to wait |
| 81 |
before strobing the printer to accept a just-written character, |
| 82 |
and the number of iterations to wait |
| 83 |
before turning the strobe off again, |
| 84 |
to |
| 85 |
.IR arg . |
| 86 |
The specification says this time should be 0.5 microseconds, |
| 87 |
but experience has shown the delay caused by the code is already enough. |
| 88 |
For that reason, the default value is 0. |
| 89 |
.\" FIXME . Actually, since Linux 2.2, the default is 1 |
| 90 |
This is used for both the polling and the interrupt driver. |
| 91 |
.TP |
| 92 |
.BR "int ioctl(int " fd ", LPSETIRQ, int " arg ) |
| 93 |
This |
| 94 |
.BR ioctl (2) |
| 95 |
requires superuser privileges. |
| 96 |
It takes an |
| 97 |
.I int |
| 98 |
containing the new IRQ as argument. |
| 99 |
As a side effect, the printer will be reset. |
| 100 |
When |
| 101 |
.I arg |
| 102 |
is 0, the polling driver will be used, which is also default. |
| 103 |
.TP |
| 104 |
.BR "int ioctl(int " fd ", LPGETIRQ, int *" arg ) |
| 105 |
Stores the currently used IRQ in |
| 106 |
.IR arg . |
| 107 |
.TP |
| 108 |
.BR "int ioctl(int " fd ", LPGETSTATUS, int *" arg ) |
| 109 |
Stores the value of the status port in |
| 110 |
.IR arg . |
| 111 |
The bits have the following meaning: |
| 112 |
.TS |
| 113 |
l l. |
| 114 |
LP_PBUSY inverted busy input, active high |
| 115 |
LP_PACK unchanged acknowledge input, active low |
| 116 |
LP_POUTPA unchanged out-of-paper input, active high |
| 117 |
LP_PSELECD unchanged selected input, active high |
| 118 |
LP_PERRORP unchanged error input, active low |
| 119 |
.TE |
| 120 |
.IP |
| 121 |
Refer to your printer manual for the meaning of the signals. |
| 122 |
Note that undocumented bits may also be set, depending on your printer. |
| 123 |
.TP |
| 124 |
.BR "int ioctl(int " fd ", LPRESET)" |
| 125 |
Resets the printer. |
| 126 |
No argument is used. |
| 127 |
.SH FILES |
| 128 |
.I /dev/lp* |
| 129 |
.\" .SH AUTHORS |
| 130 |
.\" The printer driver was originally written by Jim Weigand and Linus |
| 131 |
.\" Torvalds. |
| 132 |
.\" It was further improved by Michael K.\& Johnson. |
| 133 |
.\" The interrupt code was written by Nigel Gamble. |
| 134 |
.\" Alan Cox modularized it. |
| 135 |
.\" LPCAREFUL, LPABORT, LPGETSTATUS were added by Chris Metcalf. |
| 136 |
.SH SEE ALSO |
| 137 |
.BR chmod (1), |
| 138 |
.BR chown (1), |
| 139 |
.BR mknod (1), |
| 140 |
.BR lpcntl (8), |
| 141 |
.BR tunelp (8) |