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