tunelp
Configure parallel port devices (printers)
TLDR
Check the status of a parallel port device
Reset a given parallel port
Use a given IRQ for a device, each one representing an interrupt line
Try a given number of times to output a character to the printer before sleeping for a given time
Enable or disable aborting on error (disabled by default)
SYNOPSIS
tunelp [options] device
tunelp device -s
PARAMETERS
-i
Sets the interrupt request line (IRQ) for the specified device. Useful for resolving IRQ conflicts.
-d
Sets the Direct Memory Access (DMA) channel. Typically 0, 1, or 3.
-t
Sets the inactivity timeout in jiffies (kernel ticks). A jiffy is typically 1/100th or 1/250th of a second depending on kernel configuration.
-c
Sets the ECP (Extended Capabilities Port) mode. Values can be 0 for byte mode, 1 for PS/2 mode, 2 for EPP mode, 3 for ECP mode. Specific values might depend on the hardware.
-r
Resets the parallel port. This can clear any errors or hung states.
-a
Sets the parallel port to auto-negotiate its mode.
-P
Sets the poll time in microseconds. Used when the port operates in polling mode instead of interrupt mode.
-f
Enables or disables FIFO (First-In, First-Out) buffer usage for the port. Value 0 for disable, 1 for enable.
-o
Sets the out-of-paper retry interval.
-s
Shows the current status of the parallel port settings without making changes. This is often used alone with the device name.
device
The path to the parallel port device file, e.g., /dev/lp0
, /dev/lp1
. This is a mandatory argument.
DESCRIPTION
The tunelp
command is a Linux utility designed to examine and modify the operating parameters of a parallel port, typically used for connecting older parallel printers. It allows administrators and users to query the current status of a specified parallel port device (e.g., /dev/lp0
) and to configure various hardware-level settings.
These settings include the Interrupt Request (IRQ) line, Direct Memory Access (DMA) channel, and parallel port mode (such as ECP - Extended Capabilities Port). While crucial for troubleshooting and optimizing performance of legacy parallel devices, tunelp
is largely considered obsolete in modern Linux environments due to the widespread adoption of USB and network-based printers, which do not utilize parallel ports. Nevertheless, it remains valuable in specific niche scenarios involving older hardware or embedded systems that still rely on parallel port communication. Its primary function is to directly interact with the kernel's parallel port driver to fine-tune its behavior.
CAVEATS
- Obsolete Hardware:
tunelp
is designed for traditional parallel ports (LPT ports), which are rarely found on modern computers. Most printers today connect via USB or network. - Kernel Module Dependency: It requires the parallel port kernel module (e.g.,
lp
,parport
) to be loaded and configured correctly. - Root Privileges: Modifying parallel port settings typically requires root privileges.
- Limited Scope: It only affects the low-level parallel port driver parameters and does not directly control printer-specific features like print queues or print jobs, which are handled by print spoolers like CUPS.
- System Instability: Incorrectly setting IRQ or DMA channels can lead to system instability or conflicts with other hardware.
DEVICE NAMING
Parallel port devices are typically named /dev/lp0
, /dev/lp1
, etc., or sometimes /dev/parport0
, /dev/parport1
. The lp
devices are specific to the printer driver, while parport
devices are for general parallel port access.
JIFFIES
The -t
timeout parameter uses "jiffies," which is a unit of time defined by the kernel. The exact duration of a jiffy (e.g., 1ms, 4ms, 10ms) varies depending on the kernel's HZ compile-time option (e.g., 100, 250, 1000). Users should be aware that setting timeouts requires understanding their system's jiffy rate.
HISTORY
The tunelp
command has been a part of Linux distributions since the early days of the kernel, reflecting the prominence of parallel ports as the primary printer interface before the advent of USB. Its development closely followed the evolution of the Linux parallel port driver (parport
and lp
modules), providing a user-space interface to configure and debug these hardware components. While its importance has diminished significantly with technological advancements, it represents a historical component of Linux system administration for hardware control. It has remained largely unchanged in its core functionality for many years, primarily due to the stable nature of parallel port hardware standards.