DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Adding serial terminals

Changing serial line operation

Whenever you enable a terminal with the enable command, the system automatically sets the operating characteristics of the serial line to a set of default values. Sometimes these values do not match the values used by the terminal and, therefore, must be changed to allow communication between the system and the terminal. You can display the operating characteristics of a serial line with the stty (set tty) command. If you need to change the characteristics of a port that is enabled, you should use the entires in the gettydefs file rather than the stty commands given below.


NOTE: Any settings on a port using the stty command only last as long as the port in question is still open. As an example, if you want to change the speed of tty2a, and tty2a is not enabled, the stty command first opens the port, then changes the port settings, and finally closes the port. When it closes the port for the last time, the settings revert to the original. In the stty commands later in this section, the use of the while loop is to avoid this behavior of stty. If you run stty redirecting input without < /dev/ttyname, it works on your current serial line, which you have open. In this case, because the serial line stays open after the stty command, the settings also stay in place.

You can display the current operating characteristics of a serial line by entering this command at the terminal connected to that line:

stty -a

If it is impossible to log in at that terminal, you can use another terminal to display the characteristics. Log in as root at another terminal, and enter:

stty < ttyname

where ttyname is the name of the device special file corresponding to the serial line (see ``UNIX directories and special device files'' in the System Administration Guide).

For example, this command displays the current characteristics of the serial line named /dev/tty1a:

stty < /dev/tty1a

The command displays the speed, the parity scheme, and other information about the serial line. This information is explained in the stty(C) manual pages.

One common serial line characteristic to change is the speed. This is usually done from a terminal connected to another serial line because changing the rate disrupts communication between the terminal and the system. Before you can change the rate, you need to know the current speed of the terminal (review the terminal hardware manual to see how to determine the current speed). Once you have the speed, log in as root at the other terminal, and enter:

stty speed < ttyname

where speed is the current speed of the terminal, and ttyname is the name of the device special file corresponding to the serial line you wish to change. The speed must be one of 50, 75, 110, 134, 150, 200, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, or 921600. For example:

stty 9600 < /dev/tty1a

This command changes the speed of the serial line /dev/tty1a to 9600. Note that the symbol ``<'' is used for both displaying and setting the serial line from another terminal.

Another common change is the way the system processes input and output through the serial line. Such changes are usually made from the terminal connected to the serial line. For example:

stty tabs

This command causes the system to expand tabs with spaces (used with terminals that do not expand tabs on their own). Another example is:

stty echoe

This command causes the system to remove a deleted character from the terminal screen when you back over it with the <Bksp> key.

Note that the stty command may also be used to adapt a serial line to an unusual terminal, to another type of serial device that requires parity generation and detection, or to special input and output processing.

For a full description of this command, see the stty(C) manual page.


Next topic: Setting the terminal type at login
Previous topic: Checking terminal settings

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005