1LP(4) Linux Programmer's Manual LP(4)
2
3
4
6 lp - line printer devices
7
9 #include <linux/lp.h>
10
12 lp[0–2] are character devices for the parallel line printers; they have
13 major number 6 and minor number 0–2. The minor numbers correspond to
14 the printer port base addresses 0x03bc, 0x0378 and 0x0278. Usually
15 they have mode 220 and are owned by root and group lp. You can use
16 printer ports either with polling or with interrupts. Interrupts are
17 recommended when high traffic is expected, e.g. for laser printers.
18 For usual dot matrix printers polling will usually be enough. The
19 default is polling.
20
22 The following ioctl(2) calls are supported:
23
24 int ioctl(int fd, LPTIME, int arg)
25 Sets the amount of time that the driver sleeps before rechecking
26 the printer when the printer's buffer appears to be filled to
27 arg. If you have a fast printer, decrease this number; if you
28 have a slow printer then increase it. This is in hundredths of
29 a second, the default 2 being 0.02 seconds. It only influences
30 the polling driver.
31
32 int ioctl(int fd, LPCHAR, int arg)
33 Sets the maximum number of busy-wait iterations which the
34 polling driver does while waiting for the printer to get ready
35 for receiving a character to arg. If printing is too slow,
36 increase this number; if the system gets too slow, decrease this
37 number. The default is 1000. It only influences the polling
38 driver.
39
40 int ioctl(int fd, LPABORT, int arg)
41 If arg is 0, the printer driver will retry on errors, otherwise
42 it will abort. The default is 0.
43
44 int ioctl(int fd, LPABORTOPEN, int arg)
45 If arg is 0, open(2) will be aborted on error, otherwise error
46 will be ignored. The default is to ignore it.
47
48 int ioctl(int fd, LPCAREFUL, int arg)
49 If arg is 0, then the out-of-paper, offline and error signals
50 are required to be false on all writes, otherwise they are
51 ignored. The default is to ignore them.
52
53 int ioctl(int fd, LPWAIT, int arg)
54 Sets the number of busy waiting iterations to wait before strob‐
55 ing the printer to accept a just-written character, and the num‐
56 ber of iterations to wait before turning the strobe off again,
57 to arg. The specification says this time should be 0.5
58 microseconds, but experience has shown the delay caused by the
59 code is already enough. For that reason, the default value is
60 0. This is used for both the polling and the interrupt driver.
61
62 int ioctl(int fd, LPSETIRQ, int arg)
63 This ioctl() requires superuser privileges. It takes an int
64 containing the new IRQ as argument. As a side effect, the
65 printer will be reset. When arg is 0, the polling driver will
66 be used, which is also default.
67
68 int ioctl(int fd, LPGETIRQ, int *arg)
69 Stores the currently used IRQ in arg.
70
71 int ioctl(int fd, LPGETSTATUS, int *arg)
72 Stores the value of the status port in arg. The bits have the
73 following meaning:
74
75
76 LP_PBUSY inverted busy input, active high
77 LP_PACK unchanged acknowledge input, active low
78 LP_POUTPA unchanged out-of-paper input, active high
79 LP_PSELECD unchanged selected input, active high
80 LP_PERRORP unchanged error input, active low
81
82 Refer to your printer manual for the meaning of the signals.
83 Note that undocumented bits may also be set, depending on your
84 printer.
85
86 int ioctl(int fd, LPRESET)
87 Resets the printer. No argument is used.
88
90 /dev/lp*
91
93 The printer driver was originally written by Jim Weigand and Linus Tor‐
94 valds. It was further improved by Michael K. Johnson. The interrupt
95 code was written by Nigel Gamble. Alan Cox modularised it. LPCAREFUL,
96 LPABORT, LPGETSTATUS were added by Chris Metcalf.
97
99 chmod(1), chown(1), mknod(1), lpcntl(8), tunelp(8)
100
101
102
103Special files 1995-01-15 LP(4)