Previous Next Contents

7. How do I dial in and out with my modem using getty_ps?

Get your modem to dial out correctly. If you haven't read section How do I dial out with my modem go read it now! It contains very important setup information.

7.1 Dial in and out modem configuration

For dialin and dialout use, you have to set up your modem a certain way (again, using AT commands on your modem):

E1       command echo ON        
Q0       result codes are reported              
V1       verbose ON
S0=0     never answer (uugetty handles this with the WAITFOR option) 

If you don't set these correctly, your INIT string in your config file may fail, hosing the whole process. But, more on config files below...

&C1 DCD is on after connect only
&S0 DSR is always on
        DTR on/off resets modem (depends on manufacturer - RTFM)

These affect what your modem does when calls start and end.

If your modem does not support a stored profile, you can set these through the INIT string in your config file. See below. Some modems come with DIP switches that affect register settings. Be sure these are set correctly, too.

I have started a collection of modem setups for different types of modems. So far, I only have a few of them, if you would like to send me your working configuration, please do so! If you would like me to send you one of the configurations, just mail me and ask. I'm not listing them here due to space concerns. I have setups for Supra, Telebit T1600, USR Courier and Sportster, and Zoom 14.4/28.8 modems.

7.2 Installing getty_ps

By default, getty_ps will be configured to be Linux FSSTND (FileSystem STaNDard) compliant, which means that the binaries will be in /sbin, and the config files will be named /etc/conf.{uu}getty.ttySN. This is not apparent from the documentation! It will also expect lock files to go in /var/lock. Make sure you have the /var/lock directory.

If you don't want FSSTND compliance, binaries will go in /etc, config files will go in /etc/default/{uu}getty.ttySN, and lock file will go in /usr/spool/uucp. I recommend doing things this way if you are using UUCP, because Taylor UUCP will have problems if you move the lock files to where it isn't looking for them.

getty_ps also uses syslogd to log messages. See the man pages for syslogd(1) and syslog.conf(5) for setting up syslogd, if you don't have it running already. Messages are logged with priority LOG_AUTH, errors use LOG_ERR, and debugging uses LOG_DEBUG. If you don't want to use syslogd you can edit tune.h in the getty_ps source files to use a log file for messages instead, namely /var/adm/getty.log by default.

When you have decided if you want FSSTND, and syslog, edit tune.h and the Makefile in the getty_ps source directory to reflect you decisions. Now, install according to the instructions.

From this point on, all references to getty will refer to getty_ps. References to uugetty will refer to the uugetty that comes with the getty_ps package.

7.3 Setting up uugetty

For dialing into, and out from your modem, we want to use uugetty. uugetty does important lock file checking. Update /etc/gettydefs to include entries for modems (note that the entries point to each other, these are not for fixed speed):

# Modem entries
38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200
19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600
9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400
2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #1200
1200# B1200 CS8 # B1200 SANE -ISTRIP HUPCL #@S @L @B login: #300
300# B300 CS8 # B300 SANE -ISTRIP HUPCL #@S @L @B login: #38400

If you have a 9600 bps or faster modem, with data compression, you can lock your serial port speed and let the modem handle the transitions to other bps rates. Then, instead of the step down series of lines listed above, /etc/gettydefs only needs to contain one line for the modem:

# 38400 fixed speed
F38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #F38400
# 19200 fixed speed
F19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #F19200
# 9600 fixed speed
F9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #F9600

If you have your modem set up to do RTS/CTS hardware flow control, you can add CRTSCTS to the entries:

# 38400 fixed speed with hardware flow control
F38400# B38400 CS8 CRTSCTS # B38400 SANE -ISTRIP HUPCL CRTSCTS #@S @L @B login: #F38400
# 19200 fixed speed with hardware flow control
F19200# B19200 CS8 CRTSCTS # B19200 SANE -ISTRIP HUPCL CRTSCTS #@S @L @B login: #F19200
# 9600 fixed speed with hardware flow control
F9600# B9600 CS8 CRTSCTS # B9600 SANE -ISTRIP HUPCL CRTSCTS #@S @L @B login: #F9600

If you want, you can make uugetty print interesting things in the login banner. In my examples, I have the system name, the serial line, and the current bps rate. You can add other things:

       @B    The current (evaluated at the time the @B is seen) bps rate.
       @D    The current date, in MM/DD/YY.
       @L    The serial line to which getty is attached.
       @S    The system name.
       @T    The current time, in HH:MM:SS (24-hour).
       @U    The number of currently signed-on users.  This is  a
             count of the number of entries in the /etc/utmp file
             that have a non-null ut_name field.
       @V    The value of VERSION, as given in the defaults file.
       To display a single '@' character, use either '\@' or '@@'.

Next, make sure that you have an outgoing and incoming device for the serial port your modem is on. If you have your modem on ttyS3 you will need the /dev/cua3, and /dev/ttyS3 devices. If you don't have the correct devices, see section Creating devices in /dev on how to create devices, and create the devices.

7.4 Customizing uugetty

There are lots of parameters you can tweak for each port you have. These are implemented in separate config files for each port. The file /etc/conf.uugetty will be used by all instances of uugetty, and /etc/conf.uugetty.ttySN will only be used by that one port. Sample default config files can be found with the getty_ps source files, which come with most Linux distributions. Due to space concerns, they are not listed here. Note that if you are using older versions of getty (older than 2.0.7e), or aren't using FSSTND, then the default file will be /etc/default/uugetty.ttySN. My /etc/conf.uugetty.ttyS3 looks like this:

# sample uugetty configuration file for a Hayes compatible modem to allow
# incoming modem connections
#
# alternate lock file to check... if this lock file exists, then uugetty is
# restarted so that the modem is re-initialized
ALTLOCK=cua3
ALTLINE=cua3
# line to initialize
INITLINE=cua3
# timeout to disconnect if idle...
TIMEOUT=60
# modem initialization string... 
# format: <expect> <send> ... (chat sequence)
INIT="" AT\r OK\r\n
WAITFOR=RING
CONNECT="" ATA\r CONNECT\s\A
# this line sets the time to delay before sending the login banner
DELAY=1
#DEBUG=010

Add the following line to your /etc/inittab, so that uugetty is run on your serial port (substituting in the correct information for your environment - port, speed, and default terminal type):

S3:456:respawn:/sbin/uugetty ttyS3 F38400 vt100

Restart init:

linux# init q 

For the speed parameter in your inittab, you want to use the highest bps rate that your modem supports. Since there is no speed named 57600 or 115200, you must use the setserial program to set your serial port to a higher speed. See section How do I set up my serial ports for higher speeds? for doing this. Then, use 38400 bps in your inittab.

Now Linux will be watching your serial port for connections. Dial in from another site and login to you Linux system. Rejoice.

uugetty has a lot more options, see the man page for getty(1m) for a full description. Among other things there is a scheduling feature, and a ringback feature. RTFM :-).

7.5 US Robotics Notes

To get my USR Courier modem to reset correctly when DTR drops, I had to set &D2 and S13=1.

7.6 Supra Notes

Supra modems treat DCD differently than other modems. If you are using a Supra, you must set &C0 and not &C1. You must also set &D2 to handle DTR correctly.


Previous Next Contents