Most modems today are smart modems based upon the Hayes modems and their command sets. But as discussed above, the Linux serial console is designed to operate with a dumb modem.
Thus the smart modem is dumbed-down until it resembles a dumb modem. Some expensive modems will have a DIP switch or board jumper to put them into dumb mode.
It is essential to have a manual for the modem which describes that modem's AT commands. Although most modems agree on the more popular AT commands, they differ in the more technical commands.
Hayes AT-style modems can maintain a static speed between the computer and the modem, no matter what speed the dialing modem uses.
For most modems this is set automatically based upon the speed of the first characters sent after power-on.
Power cycle the modem and connect to it with the command minicom -o console. Press Enter a few times. The modem should now be running at the same bit rate used by Minicom, which we set to the speed of the serial console in Section 12.1.
You can check the port speed by asking the modem to generate some output.
Figure 12-2. Testing the modem's port speed
bash# minicom -o console Welcome to minicom Press CTRL-A Z for help on special keys Enter Enter Enter ATI Enter 56k V.90 Series 3 External V2.20 Ctrl-A Q Leave without reset? Yes
Some modems have an AT command to re-establish the port speed, look in your modem's manual for the AT&B1 command. Some modems have a command to explicitly set the port speed, look in you modem's manual for the ATB command.
The modem will answer an incoming call on the second ring using the command ATS0=2.
Don't answer the phone on the first ring as this may invalidate the certification of the modem in some telephony jurisdictions.
CTS/RTS handshaking prevents lost characters.
The AT command is AT&K3.
Data Carrier Detect should follow the presence or absence of a calling modem.
The AT command is AT&C1.
Data Terminal Ready should control the modem. If DTR is high the modem is ready to receive calls. If DTR is low the modem should not receive any more calls and should hang up any existing call.
The AT command is AT&D2.
A Hayes AT-style modem usually outputs a message when a call is received. For example:
The modem has a "quiet mode" that disables these messages.
The AT command is ATQ1. There will be no OK printed in response to this command.
Echoing commands can confuse the console, so turn off command echoing.
The AT command is ATE0.
Most modems have a speaker. By default this is connected whilst a modem is connecting and negotiating a common protocol and speed. This is very useful for a dialing modem, as it prevents a human being accidentally repeatedly called. The speaker can be annoying on answering modems.
If a quieter computer room is desirable, use the ATM0 command to turn off the speaker.
Data Terminal Ready drops when the semiconductor that supports the RS-232 link is reset. This then hangs up the modem. This can be annoying. If the getty supports a parameter similar to mgetty's toggle-dtr-waittime then it is possible to extend the time that the modem will ignore DTR. The time that getty holds DTR low to force a hang up is extended beyond the modem's setting. The result is that resetting the semiconductor does not hang up the modem, but getty can still hang up the modem at the end of a login session.
Check your modem's documentation. Our example modem uses S-register 25 to contain the threshold for noticing a change in DTR. The value is in one-hundreds of a second. By setting the modem with ATS25=150 (1.5 seconds) and setting mgetty with toggle-dtr-waittime 2000 (2 seconds) we ignore small blips in DTR.
Once the modem is correctly configured and works well, disable the +++ sequence that gives access to the modem's command mode.
The AT command is ATS2=255.
If this command is accidentally given see Section 12.3.12 to reset the modem to its factory default parameters and start again.
If you need to issue more AT commands to the modem then power cycle the modem. This should place the modem into command mode.
Now issue the following commands to restore the modem's factory configuration.
Figure 12-4. Resetting a Hayes AT-style modem
bash# minicom -o console Welcome to minicom Press CTRL-A Z for help on special keys AT &F &Y0 &W &W1 Enter OK AT Z Enter OK Alt-A Q Leave without reset? Yes
If this fails then you will need to clear the modem's configuration memory. The procedure for this varies by manufacturer, and probably requires the disassembly of the modem.