lp(4)

πŸ’– lp(4) β€” the line printer device page, bestie edition πŸ’–

Okay so this is from the Kernel Interfaces Manual, and it's all about lp β€” as in, line printer devices. Yes, actual printers, vintage energy, but hear me out because this is lowkey iconic. πŸ–¨οΈβœ¨


✨ NAME ✨

lp β€” line printer devices. That's it, that's the name, short and slay.


🌸 SYNOPSIS 🌸

#include <linux/lp.h>

That's the whole vibe. Include the header, get the toys. πŸŽ€


πŸ¦‹ CONFIGURATION πŸ¦‹

So lp[0–2] are character devices for your parallel line printers, and they have major number 6 and minor number 0–2. Those minor numbers match up with the printer port base addresses like this:

  • lp0 β†’ 0x03bc
  • lp1 β†’ 0x0378
  • lp2 β†’ 0x0278

Usually they have mode 220 and they're owned by user root and group lp. Classic.

Now, the way that you can talk to printer ports is either with polling or with interrupts. Interrupts are the recommended route when high traffic is expected β€” think laser printers, they're doing the most. For typical dot matrix printers, polling will usually be enough, no cap. The default is polling. 🫢


πŸ’… DESCRIPTION πŸ’…

The following ioctl(2) calls are supported, and they are giving main character energy, one by one:

  • 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, and it sets it to arg. Fast printer? Decrease this number. Slow printer? Increase it. It's measured in hundredths of a second, and the default 2 means 0.02 seconds. Heads up: it influences only the polling driver.
  • 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, and sets it to arg. Printing too slow? Increase the number. System getting too slow? Decrease it. Default is 1000. Again, it influences only the polling driver.
  • int ioctl(int fd, LPABORT, int arg) β€” If arg is 0, the printer driver will retry on errors; otherwise it will abort. The default is 0.
  • int ioctl(int fd, LPABORTOPEN, int arg) β€” If arg is 0, open(2) will be aborted on error; otherwise the error will be ignored. The default is to ignore it.
  • int ioctl(int fd, LPCAREFUL, int arg) β€” If 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.
  • 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, and it sets both of those to 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. This one is used for both the polling and the interrupt driver.
  • int ioctl(int fd, LPSETIRQ, int arg) β€” This ioctl(2) requires superuser privileges, bestie, so act accordingly. πŸ‘‘ It takes an int containing the new IRQ as argument. As a side effect, the printer will be reset. When arg is 0, the polling driver will be used, which is also the default.
  • int ioctl(int fd, LPGETIRQ, int *arg) β€” Stores the currently used IRQ in arg.
  • int ioctl(int fd, LPGETSTATUS, int *arg) β€” Stores the value of the status port in arg. The bits mean the following:
    • 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

Refer to your printer manual for the meaning of the signals. And note that undocumented bits may also be set, depending on your printer. πŸ™ˆ

  • int ioctl(int fd, LPRESET) β€” Resets the printer. No argument is used. Simple, clean, periodt.

πŸ“ FILES πŸ“

  • /dev/lp*

🌈 SEE ALSO 🌈


That's the whole page, and honestly? Ate. πŸ’– This was served to you fresh from Linux man-pages 6.20, dated 2025-09-21 β€” go forth and print responsibly, bestie. 🧚✨

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: GPL-2.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms