-->
Previous Table of Contents Next


Adding Serial Port Terminals

You can use the serial ports on the PC to add remote terminals. The terminal can be a dedicated terminal or another PC running terminal-emulation software. Linux doesn’t really care about the identity of the remote machine, except when it comes to sending instructions for screen displays.

The wiring of cables between the remote terminal and the PC hosting the Linux operating system depends on the type of connectors at both ends. In most cases, the cable is a DTE- (Data Terminal Equipment) to-DTE type, although some terminals and PC serial ports require DCE (Data Communications Equipment) cabling. As a general rule, terminals and remote computers use DTE and modems use DCE. The difference between DTE and DCE cabling is in the way the wires run from each end connector.

When connecting a terminal, however, some of the pins must be crossed to permit signals to pass properly. The wiring of such a cable (often called a null modem cable or hard wired cable) requires several crosses or shorts to make the connection valid. Serial port connectors on a PC are either a DB9 (9-pin) or a DB25 (25-pin) connector. Not all of the wires in the 25-pin (or the 9-pin, for that matter) are required for a terminal device. A complete terminal cable can be made of only three pins (send, receive, and ground), although Linux also uses the Carrier Detect wire to tell when a terminal is attached and active.

A typical DCE cable (such as for a modem) uses straight-through wiring, meaning that pin 1 on the PC end goes to pin 1 on the modem end, pin 2 goes through to pin 2, and so on. This is called a straight cable (also called a modem cable by some). The important pins and their meanings for DTE (computer to terminal) 25-pin cables are shown in Table 33.1. The cable numbers are changed for 9-pin connectors, but the crossings are the same.

Table 33.1. DTE cables for a 25-pin connector.

Terminal Pin Computer Pin Meaning

1 1 Ground
2 3 Transmit data / receive data
3 2 Receive data / transmit data
4 4 Ready to send
5 5 Clear to send
6 20 Data set ready / data terminal ready
7 7 Ground
8 20 Carrier detect / data terminal ready
20 6, 8 Data terminal ready / data set ready, carrier detect

Because most users want to purchase premade cables to connect remote terminals, we won’t deal with building your own cables. Instead, simply visit your local computer store and explain the equipment at both ends, as well as whether you have DB9 (9-pin) or DB25 (25-pin) connectors at each end. Also note whether the connectors at each end are male (pins sticking out) or female (no pins). Usually, the PC has male serial port connectors (requiring a female end on the cable) and a terminal has female connectors (requiring a male connector on the cable); but, if you’re connecting a remote PC, you need female connectors at both ends.


Note:  
If the wiring of a cable isn’t clearly indicated and the vendor doesn’t know whether it’s a straight-through or null modem cable, you might need to purchase a null modem device. A null modem is a short connector that has the pin crossings within it, effectively converting a straight-through cable to a null modem cable, and vice versa.

The Login Process

To understand the files involved in a terminal configuration, it is useful to look at the process that occurs whenever a login occurs.

The process begins with the /etc/init daemon executing when the Linux system is booted. The init daemon is responsible for running the /etc/getty program for each terminal that is connected to the system. The init daemon knows whether a terminal is connected because of entries in two files: /etc/ttys and /etc/inittab. The /etc/ttys file lists all ports on the system and the type of terminal that is connected. The /etc/inittab file has a complete list of all terminals and their parameters. We’ll look at both files in more detail later, in the section “Terminal Files: /etc/ttys and /etc/inittab.”

When the /etc/ttys and /etc/inittab files indicate that a terminal is connected and active, the init daemon runs the /etc/getty program for that terminal. The getty program sets the communications parameters for the terminal and displays the login prompt on the screen.

When a user logs in on the terminal, the getty process executes the login program to request a password. The login program then validates the username and password against the entries in the /etc/passwd file. If the login is valid, the login program displays the message of the day (stored in the file /etc/motd) and executes whatever shell the user is supposed to run (as specified in /etc/passwd). Finally, the login program sets the TERM environment variable and exits.

When the login process terminates, the shell continues to execute and reads the startup files; then, it generates the shell prompt and waits for the user to issue instructions.

As you have seen, many files are involved in the startup process, all in the /etc direc-tory. We can look at the important files (at least for terminal characteristics) in more detail.


Previous Table of Contents Next