Getting the modem to hang up

Sometimes you may find that KPPP has difficulties hanging up the modem. This is likely the result of a mismatch between KPPP settings and those of the modem. A standard modem uses two methods to decide to hangup: Command, and DTR. The Command method involves sending an escape sequence to the modem, which puts it in command mode, then issuing the hangup command (ATH).

Outside of KPPP, when configuring the pppd package manually, it's often helpful to use the command method, so that one can exit a terminal session, and then start pppd without having the modem hangup. In most other situations, the DTR method is preferred, as it is simpler.

DTR (AT&Dn) method

The DTR method will have the modem hangup whenever KPPP stops using the modem. If you obtain a modem session, and query the state via AT&V, and you can see among the displayed settings for the active profile a &D0, then the DTR hangup method is disabled. To enable the DTR method, use the Terminal button to get a modem session, then:

ATZ # reset to default profile
AT&D2  # Set to hang up on DTR drop
AT&W  # Write to default profile

How the DTR method works

Whenever the Data Terminal Ready (DTR) line on the serial line between the host computer and the modem goes high, the modem hangs up. When KPPP opens the serial port, the DTR line is pulled low, on an external modem, you can see the DTR (or TR) light come on when this happens. When the TR light goes out (because KPPP has closed the serial port, or something worse!), the modem will hangup.

Command method

The other way to have a modem hang up when connected (used when AT&Dn where n is not 2) is to have the modem accept the command when a session is in progress. To have it hang up properly, get a modem session, and set the guard time to a short interval like so:


Then use the Guard Time slider in the Modem commands section to match the register (S12 to this value 5. The modem should then hangup properly.

How the Command Method Works

When the local modem is connected to a remote modem, it is in the connect state, where it passes all characters it receives to the remote modem without interpretation. To have the modem accept the characters as commands for itself, one must put the modem into the command state. The escape code does this.

The escape code is defined as being three intervals of time whose length is defined by S12 in fiftieths of a second.

  • Quiet (must last more than S12/50 seconds)

  • Escape character (defined by the register S2, the default is +), repeated three times (less than S12/50 seconds between each.

  • Quiet (must last more than S12/50 seconds)

Once the modem is in the command state, you can send it commands. To have it hang up, send the command ATH. The escape codes and the hangup string used by KPPP are shown in the Modem Commands dialog. These should match your modem.