8 How do I set up a terminal connected to my PC?

Contents of this section

8.1 Hardware requirements

Make sure you have the right kind of cable. A null modem cable bought at a computer store will do it. But it must be a null modem cable! Make sure you are using your serial port, and not your parallel port.

At a minimum, you should have (for a DB25 connector):

        RxD   Receive Data          2 - 3       TxD   Transmit Data
        TxD   Transmit Data         3 - 2       RxD   Receive Data
        GND   Signal Ground         7 - 7       GND   Signal Ground

If you want to have flow control and hardware handshaking, you must have a full null modem cable:

              Frame Ground          1 - 1             Frame Ground
        RxD   Receive Data          2 - 3       TxD   Transmit Data
        TxD   Transmit Data         3 - 2       RxD   Receive Data
        RTS   Request To Send       4 - 5       CTS   Clear To Send     
        CTS   Clear To Send         5 - 4       RTS   Request To Send 
        DSR   Data Set Ready        6 - 20      DTR   Data Terminal Ready
        GND   Signal Ground         7 - 7       GND   Signal Ground
        DCD   Carrier Detect        8 - 20      DTR   Data Terminal Ready
        DTR   Data Terminal Ready  20 - 6       DSR   Data Set Ready
        DTR   Data Terminal Ready  20 - 8       DCD   Carrier Detect

If you have a DB9 connector on your port, try the following:

                                  DB9   DB25 
        RxD   Receive Data          2 - 2       TxD   Transmit Data
        TxD   Transmit Data         3 - 3       RxD   Receive Data
        GND   Signal Ground         5 - 7       GND   Signal Ground

Alternatively, a DB9-DB25 null modem cable:

                                  DB9   DB25 
        DCD   Carrier Detect        1 - 20      DTR   Data Terminal Ready
        RxD   Receive Data          2 - 2       TxD   Transmit Data
        TxD   Transmit Data         3 - 3       RxD   Receive Data
        DTR   Data Terminal Ready   4 - 6       DSR   Data Set Ready
        DTR   Data Terminal Ready   4 - 8       DCD   Carrier Detect
        GND   Signal Ground         5 - 7       GND   Signal Ground
        DSR   Data Set Ready        6 - 20      DTR   Data Terminal Ready
        RTS   Request To Send       7 - 5       CTS   Clear To Send
        CTS   Clear To Send         8 - 4       RTS   Request To Send
        (RI Ring Indicator          9 not needed)

If you are not using a full null modem cable, you might have to do the following trick: on your computer side of the connector, connect RTS and CTS together, and also connect DSR, DCD and DTR together. This way, when the computer wants a certain handshaking signal, it will get it (from itself).

Now that you have the right kind of cable, connect your terminal to your computer. If you can, tell you terminal to ignore modem control signals. Try using 9600 bps, 8 data bits, 1 stop bit, no parity bits for the terminal's setup.

8.2 Setting up getty

Replace the stock getty with getty_ps as described in section What is getty_ps? . Add an entry for getty to use for your terminal in /etc/gettydefs:

# 38400 bps Dumb Terminal entry
DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #S @L login: #DT38400
# 19200 bps Dumb Terminal entry
DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #S @L login: #DT19200
# 9600 bps Dumb Terminal entry
DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #S @L login: #DT9600

You can add HUPCL so the login is killed whenever you switch of the terminal (provided you use a proper null modem cable).

If you want, you can make getty print interesting things in the login banner. In my examples, I have the system name and the serial line printed. You can add other things:

@B    The current (evaluated at the time the @B is seen) bps rate.
@D    The current date, in MM/DD/YY.
@L    The serial line to which getty is attached.
@S    The system name.
@T    The current time, in HH:MM:SS (24-hour).
@U    The number of currently signed-on users.  This is  a
      count of the number of entries in the /etc/utmp file
      that have a non-null ut_name field.
@V    The value of VERSION, as given in the defaults file.
To display a single '@' character, use either '\@' or '@@'.

Edit your /etc/inittab file to run getty on the serial port (substituting in the correct information for your environment - port, speed, and terminal type):

S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100

Restart init:

linux# init q 

At this point, you should see a login prompt on your terminal. You may have to hit return a couple of times to get the terminal's attention. Rejoice. Party. Log in on your terminal and PC. talk to yourself from accross the room.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter