Next Previous Contents

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

7.1 Introduction

This configuring is normally done by your communications program such as wvdial. It may do much of it without even letting you know what it's done. In olden days it was done with the "stty" utility. If you set something manually with stty, the communications program may change the setting to something else so it's usually best to just let the communications program handle it. See What is stty ?

7.2 Hardware flow control (RTS/CTS)

See Flow Control for an explanation of it. You should always use hardware flow control if possible. Your communication program or "getty" should have an option for setting it (and hopefully it's enabled by default). It needs to be set both inside your modem (by an init string or default) and in the device driver. Your communication program should set both of these (if you configure it right).

If none of the above will fully enable hardware flow control. Then you must do it yourself. For the modem, make sure that it's either done by the init string or is on by default. If you need to tell the device driver to do it is best done on startup by putting it in a file that runs at boot-time. See the subsection Boot-time Configuration You need to add the following to such a file for each serial port (example is ttyS2) you want to enable hardware flow control on:

stty -F /dev/ttyS2 crtscts
or
stty crtscts < /dev/ttyS2

If you want to see if flow control is enabled do the following: In minicom (or the like) type AT&V (or ATI4 on 3Com modems) to see how the modem is configured and look for &K3 (or &H1 on 3Com modems) which means hardware flow control. Then without exiting the communications program (such as minicom) see if the device driver knows about it by typing: stty -F /dev/ttyS2 -a. Look for "crtscts" (without a disabling minus sign). Remember that communication programs change these settings so you may want to check them after you have started up your communication program.

7.3 Speed Settings

Besides flow control there is speed. See What Speed Should I Use with My Modem. There's also are parity and bits-per-byte settings. Normally the port is set by the communications program at 8N1 (8-bits per byte, No parity, and 1 stop bit). If you're running PPP then you must use 8N1. So if you get a complaint that it's not 8-bit clean then it's likely not 8N1 like it should be.

7.4 Ignore CD Setting: clocal

If the modem is not sending a CD signal and clocal is disabled (stty shows -clocal) then a program may not be able to open the serial port. If the port can't open, the program may just hang, waiting (often in vain) for a CD signal from the modem. Actually, a skilled programmer can write the program in such a way as to force the port to open even when CD and -clocal say not to so it's not always a problem.

One way to avoid any possible problems is to send "AT&C" to the modem so that CD from the modem will always be on. CD always-on is fine for dial-out but for dial-in the CD signal is sometimes (but rarely) used to detected an incoming call.

Minicom sets clocal automatically when it starts up so there is no problem. But version 6.0.192 of Kermit hung when I set -clocal and tried to "set line ...".

Here's a problem that existed prior to the year 2000 or thereabouts. It's since been fixed. If -clocal is set and there is no CD signal, then the "stty" command will hang and there is seemingly no way to set clocal (except by running minicom). But minicom will restore -clocal when it exits. One way to get out of this is to use minicom to send the "AT&C" to the modem (to get the CD signal) and then exit minicom with no reset so that the CD signal always remains on. Then you may use stty again.

7.5 What is stty ?

stty is something like setserial but it sets the speed (baud rate), hardware flow control, and other parameters of a serial port. Typing "stty -F /dev/ttyS2 -a" should show you how ttyS2 is configured. Most of the stty settings are for things that you never need to use with modems. Many of the setting are only needed for Text-Terminals (and some are only needed for antique terminals of the 1970s). Your communication package should automatically set up the several settings needed for modems. For this reason you normally don't need to use stty so it's not covered much in this Modem-HOWTO. But stty is sometimes useful for trouble-shooting. More is said about stty in the Serial-HOWTO or Text-Terminal-HOWTO..


Next Previous Contents