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.
You can display the current operating characteristics of a serial
line by entering this command at the terminal connected to that line:
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
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.
must be one of 50, 75, 110, 134, 150, 200,
300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200,
230400, 460800, or 921600.
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:
This command causes the system to expand tabs with spaces (used
with terminals that do not expand tabs on their own). Another example is:
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.