Hardware manual
Introduction
stty does much of the configuration of the serial port but since application programs (and the getty program)
often handle this, you may not need to use it much. It's handy if you're having problems or want to see how
the port is set up. Try typing ``stty -a'' at your terminal/console to see how it's now set. Also try typing it
without the -a (all) for a short listing which shows how it's set different than "normal" which is how it's set
using the command "stty sane". Don't try to learn all the setting unless you want to become a serial
historian since many of the settings are only for slow antique dumb terminals of the 1970's. Most of the
defaults should work OK.
stty is documented in the man pages with a more detailed account in the info pages. Type "man stty" or
"info stty".
Many of the stty options start with an "o" (output) or an "i" (input). For example: onlcr. Output is the flow
of bytes out of the computer while input is the flow of bytes into the computer. The "point of view" is the
computer, not the serial port or the device connected to the serial port. For example, received input data comes
in on a cable and goes to the serial port chip. This chip, after converting the bits from the serial to parallel
representation, then sends it (via a program read) to the large serial port buffer in main computer memory.
Thus the chip has both input and output but since it's input data to the computer, its output is considered to be
input. The situation is similar for output flowing thru this chip. The "input" and "output" refer to the direction
of flow with respect to the computer and not the serial port hardware (the chip).
Whereas setserial only deals with actual serial ports, stty is used both for serial ports and for virtual
terminals such as the standard Linux text interface on a PC monitor. For the PC monitor, many of the stty
settings are meaningless. Changing the baud rate, etc. doesn't appear to actually do anything.
Here are some of the items stty configures: speed (bits/sec), parity, bits/byte, # of stop bits, strip 8th bit?,
modem control signals, flow control, break signal, end-of-line markers, change case, padding, beep if buffer
overrun?, echo what you type to the screen, allow background tasks to write to terminal?, define special
(control) characters (such as what key to press for interrupt). See the stty man or info page for more details.
Also see the man page: termios which covers the same options set by stty but (as of mid 1999) covers
features which the stty man page fails to mention.
With some implementations of getty (getty_ps package), the commands that one would normally give to stty
are typed into a getty configuration file: /etc/gettydefs. Even without this configuration file, the getty
command line may be sufficient to set things up so that you don't need stty.
One may write C programs which change the stty configuration, etc. Looking at some of the documentation
for this may help one better understand the use of the stty command (and its many possible arguments).
Serial-Programming-HOWTO may be useful but it's outdated. The manual page: termios contains a
description of the C-language structure (of type termios) which stores the stty configuration in computer
memory. Many of the flag names in this C-structure are almost the same (and do the same thing) as the
arguments to the stty command.
Flow control options
To set hardware flow control use "crtscts". For software flow control there are 3 settings: ixon, ixoff, and
ixany.
Serial HOWTO
Introduction 48