Terminal Device Model (The GNU C Library)

### 17.1 Terminal Device Model ¶

A terminal device, abbreviated `tty` (for teletype), is a character device which implements a set of functionality appropriate for communications devices, and which can host an interactive login session. Conceptually, a terminal device implements an RS232 asynchronous serial interface, but the actual hardware implementation may be entirely different, or it may be entirely virtual, notably see Pseudo-Terminals.

For a true conventional asynchronous serial port, such as RS232/V.24, RS422/V.11, RS423, or RS485, the functionality is generally as described, whereas for other devices, the meaning of serial port specific functionality such as modem control signals, BREAK, and line speed is device specific.

The rest of this section is described in terms of a physical RS232 interface.

The RS232 specification assumes the host (Data Terminal Equipment, DTE) connects to a modem (Data Communications Equipment, DCE), regardless of if a physical modem is present or not.

In addition to the serial data, the DTE provides a set of control signals to the DCE, and the DCE a set of status signals to the DTE. The full RS232 and V.24 specifications provide a large number of signals, but the ones that are typically implemented in contemporary hardware and are relevant to the terminal device interface are:

DTR - Data Terminal Ready (control)

  If asserted (true), the DTE is ready to accept/continue an incoming communications session. If deasserted (false), this is a modem disconnect request to the DCE. The DCE may, but is not required to, trigger a modem disconnect in response.

RTS - Request To Send (control)

  This signal is also referred to as Ready To Receive (RTR).

  If asserted, the DTE is ready to accept data. If deasserted, the DCE is requested to hold data temporarily without disconnecting. This is known as hardware or RTS/CTS flow control and can be handled automatically if the appropriate terminal mode flags are set.

DSR - Data Set Ready (status)

  If asserted, the DCE is ready to communicate, but may or may not have a connection to a remote peer.

DCD - Data Carrier Detect (status)

  If asserted, the DCE has a connection to the remote peer. If deasserted, this is a modem disconnect signal to the DTE. A modem disconnect may be triggered in response to the DTR control signal being deasserted, or it may be caused by an external event.

CTS - Clear To Send (status)

  If asserted, the DCE is ready to accept data. If deasserted, the DTE is requested to hold data temporarily but should not interpret it as a disconnect. This is the DCE to DTE part of RTS/CTS flow control.

RI - Ring Indicator (status)

  If asserted, this indicates that a remote peer is requesting to connect (“the phone is ringing”). Depending on how the DCE is configured, the DTE may need to assert the DTR control signal before the DCE will accept the incoming connection.