LinuxCommandLibrary

ldattach

Attach line discipline to serial port

SYNOPSIS

ldattach line_discipline tty_device

PARAMETERS

line_discipline
    Specifies the line discipline to attach. This is often a number corresponding to a defined line discipline in the kernel, or a name (e.g., 'n_hdlc', 'slip').

tty_device
    Specifies the TTY device to attach the line discipline to. This is typically a serial port device like /dev/ttyS0 or /dev/ttyUSB0.

DESCRIPTION

The ldattach command attaches a line discipline to a specified serial port or TTY device. Line disciplines are kernel modules that transform and interpret the data stream passing through the serial port. This is commonly used for specialized communication protocols or terminal emulations. Without a line discipline, the serial port operates in raw mode. ldattach is typically used to configure serial ports for specific uses such as slip (Serial Line Internet Protocol) or ppp (Point-to-Point Protocol) connections or to emulate a particular type of terminal like a VT100. Correct configuration requires root privileges, and incorrect use can cause communication problems. ldattach manages the association between the serial port device and the kernel's line discipline subsystem, which includes managing modes, drivers, and protocols for the attached interface.

CAVEATS

Requires root privileges. Incorrect line discipline settings can render the serial port unusable until reconfigured. Requires that the line discipline kernel module is loaded.

USAGE EXAMPLE

To attach the SLIP line discipline (number 16) to /dev/ttyS1:
ldattach 16 /dev/ttyS1

LINE DISCIPLINE NUMBERS

The specific line discipline numbers available can vary depending on the kernel configuration. Consult your system's documentation or kernel configuration to determine valid line discipline numbers.

HISTORY

The ldattach command has been a part of Linux systems for many years, offering a simple mechanism to interface with serial lines. Its usage has become somewhat less common due to newer networking technologies, but remains relevant in embedded systems and legacy applications that still rely on serial communication.

SEE ALSO

stty(1), tty(1)

Copied to clipboard