Next Previous Contents

9. Configuring the Serial Driver (high-level) "stty"

9.1 Overview

See the section Stty. The "stty" command sets many things such as flow control, speed, and parity. The only one discussed in this section is flow control.

9.2 Flow Control

Configuring Flow Control: Hardware Flow Control is Usually Best See Flow Control for an explanation of it. It's usually better to use hardware flow control rather than software flow control using Xon/Xoff. To use full hardware flow control you must normally have two dedicated wires for it in the cable between the serial port and the device. If the device is on a card or the motherboard, then it should always be possible to use hardware flow control.

Many applications (and the getty program) give you an option regarding flow control and will set it as you specify or it might enable hardware flow control by default if you don't set it. It must be set both in the serial driver and in the hardware connected to the serial port. How it's set into this hardware is hardware dependent. Sometimes there is a certain "init string" you send to the hardware device via the serial port from your PC. For a modem, the communication program should set it in both places.

If a program you use doesn't set flow control in the serial driver, then you may do it yourself using the stty command. Since the driver doesn't remember the setting after you stop Linux, you could put the stty command in a file that runs at start-up or when you login (such as /etc/profile for the bash shell). Here's what you would add for hardware flow control for port ttyS2:

stty -F /dev/ttyS2 crtscts
or for old stty versions < 1.17:
stty crtscts < /dev/ttyS2

crtscts stands for a Control setting to use the RTS and CTS pins of the serial port for hardware flow control. Note that RTS+CTS almost spells: crtscts and the initial "c" means "control".


Next Previous Contents