6 What is setserial? How do I dial out with my modem?

Contents of this section

6.1 Hardware requirements

First, make sure you have the right cable. Your modem requires a straight through cable, with no pins crossed. Any computer store should have these. Make sure you get the correct gender. Your DB25 serial port on your PC is always male. Do not confuse it with the parallel port, which is the female DB25. Hook up your modem to one of your serial ports. Consult your modem manual on how to do this if you need help.

Notes on internal modems

For an internal modem, you will not need a cable. An internal modem does not need a serial port, it has one built in. All you need to do is configure it to use an interrupt that is not being used, and configure the I/O address. Consult your modem manual if you get stuck. Also, see section Can I use more than 2 serial devices? if you need help on choosing interrupts or addresses.

Due to a bit of stupidity on IBM's part, you may encounter problems if you want your internal modem to be on ttyS3. If Linux does not detect your internal modem on ttyS3, you can use setserial and the modem will work fine. Internal modems on ttyS{0-2} should not have any problems being detected.

6.2 Talking to your modem

Make sure that nothing is using the serial port you hooked your modem to. Check your /etc/inittab for getty processes using the serial port. Comment the line out (with a ``#'') and restart init:

linux# init q

Do not comment any lines that contain a ttyN device, only ones containing ttySN devices. ttyN devices are your virtual consoles.

Use kermit to test the setup. For example, say your modem was on ttyS3, and it could handle 2400 bps. You would do the following:

linux# kermit
C-Kermit 5A(188), 23 Nov 92, POSIX
Type ? or HELP for help
C-Kermit>set line /dev/cua3
C-Kermit>set speed 2400
/dev/cua3, 2400 bps
C-Kermit>c
Connecting to /dev/cua3, speed 2400.
The escape character is Ctrl-\ (ASCII 28, FS)
Type the escape character followed by C to get back,
or followed by ? to see other options.
AT
OK
<ctrl>-\-C
(Back at linux)
C-Kermit>quit
linux#

If your modem responds to AT commands, you can assume your modem is working correctly on the Linux side. Try calling another modem. If you don't like kermit, try one of the more advanced comm programs. Check out section Noteworthy communications programs about comm programs if you need some pointers.

6.3 Dial out modem configuration

For dial out use only, you can configure your modem however you want.

I like to see result codes, so I set Q0 - result codes are reported. To set this on my modem, I would have to preceed the register name with an AT command. Using kermit or some comm program, connect to your modem and do the following:

ATQ0

If your modem says OK back to you, then the register is set. Do this for each register you want to set.

I also like to see what I'm typing, so I set E1 - command echo on. If your modem has data compression capabilities, you probably want to enable them. If you can lock the serial port speed, and let the modem handle modem-modem bps rate transitions, do this. Consult your modem manual for more help, and a full listing of options. If your modem supports a stored profile, be sure to write the configuration to the modem (often done with AT&W) if not you will have to set the registers everytime you turn on your, or reset your modem.

When you dial out with your modem, set the speed to the highest bps rate that your modem supports. Since there is no speed named 57600 or 115200 bps, 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, set the speed to 38400 bps in your comm program.

6.4 Hardware flow control

If your modem supports hardware flow control (RTS/CTS), I highly recommend you use it. This will allow you to lock your serial port - modem speed (DTE - DCE) at a high bps rate, independant from the modem - modem speed. This is particularly important for modems that support data compression. First, you have to enable RTS/CTS flow control on the serial port itself. This is best done on startup, like in /etc/rc.local or /etc/rc.serial:

stty crtscts < /dev/cua3

Be sure to put in the correct serial port you wish to enable.

You must also enable RTS/CTS flow control on your modem. Consult your modem manual on how to do this, as it varies between modem manufacturers. Be sure to save your modem configuration if your modem supports stored profiles.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter