SYNOPSIS
modemu [-c comm_prog] [-d pty_master] [-e atcmds] [-h] [-s] [-]DESCRIPTION
Modemu is a TELNET client with a modem-like user interface. It can redirect its I/O via a pty(4) so that a comm program can handle the pty as a tty with a real modem.Modemu has two major modes: a command mode and online mode. When invoked, modemu is in the command mode, waiting for AT commands input. Entering a D or O command will put into the online mode, in which modemu communicate with a remote host. Connection closing or a escape command input returns to the command mode.
OPTIONS
- -c comm_prog
-
Invoke a comm program comm_prog.
Modemu
invokes it by passing /bin/sh an option `-c comm_prog'.
Therefore, any
sh(1)
commands can be specified.
The string comm_prog can include a `%s',
which will be replaced with the
device name of the slave device after removal of the initial "/dev/".
-
Example:
- modemu -c "xc -l %s"
-
Example:
- -d pty_master
- Open a file pty_master and talk through it. A named pipe can be a pty_master as well as a pty master device because modemu doesn't ioctl a pty_master.
- -e atcmds
- Execute a series of AT commands atcmds initially. Atcmds must have an `AT' or `at' prefix. D and O commands in atcmds are ignored.
- -h
- Print a usage summary.
- -s
- Print the last two letters of a device name. The device is a pty master device which modemu talks through. Therefore, when modemu prints `p8', comm program must open /dev/ttyp8.
- `-'
- Modemu talks through the standard input/output. (Default)
Note: -c, -d, -s and - options are exclusive each other. If two or more of the options are specified, only the last one is effective.
COMMAND MODE
Command mode expects lines in the following format:- [garbage]at[sp][cmd[sp]]...cr
where at is an `AT' or `at', sp is spaces, cr is a carriage return character (register S3), garbage is a string includes no at. If a `#' prefixes a line, the line is ignored. Available cmds are listed below. They are all case in-sensitive except for some literally used arguments. A (*) marks default settings.
- Dstr
-
Dialing command.
Open a connection to host.
If port is specified,
modemu
attempts to connect with the port instead of the default TELNET port,
and
doesn't initiate TELNET option negotiation.
The following formats are available for str:
-
- host[:port]
- Host is an Internet address in numbers-and-dots notation. Optional port is a port number.
- "host[:port]["]
- Host is an Internet address or host name. Optional port is a port number or service name. The closing double quote can be omitted if no command follows.
Str can be prefixed with `T', `P', `digitW' and/or `digit,'. The prefixes are simply ignored.
Example:-
ATDT0W127.0.0.1
ATDP"foo.bar.jp:daytime
-
- E1
- No operation.
- F1
- No operation.
- H[0]
- Close the current TELNET session.
- In
-
Print various information.
-
- I4
- Current settings
- I5
- `&W'ed settings
- I6
- TELNET option states
- I7
- Modemu version
-
- O[0]
- Return to online mode.
- P
- No operation.
- Q[0]
- No operation.
- T
- No operation.
- V1
- No operation.
- X[0]
- No operation.
- Sn=m
- Set S-register Sn to m. A number from 0-255 is allowed for m.
- Sn?
- Print an S-register Sn's value.
- Z
- Close the current TELNET session, and restore `&W'ed settings.
- &W
- Save current settings. The saved settings will be lost with the end of the process because they are not stored into NV-RAM nor files.
- %Bn=m
-
Control TELNET binary option.
Valid values for n are:
-
-
- 0
- Control the local (modemu) option
- 1
- Control the remote (TELNET server) option
Valid values for m are:
-
- 0
- Request non-binary transmission mode (*)
- 1
- Request binary transmission (8bit through) mode
- above+2
- Disconnect if the request is refused
Example:
-
- AT%B1=1
- Requesting binary mode in remote-to-modemu direction
- AT%B0=3%B1=3
- Requesting binary mode in both remote-to-modemu and modemu-to-remote direction. No use connecting in non-binary mode (using file xfer protocol or something)
-
-
- %Dn
-
Control dial-canceling.
-
- %D0
- A keypress cancels dialing (*)
- %D1
- Keypresses don't cancel dialing
-
- %Ln
-
Control line-mode.
-
- %L0
- Request character-at-a-time mode (*)
- %L1
- Request line-at-a-time mode (old line-mode). Input characters are buffered and not sent until a CR character is entered.
-
- %Q
- Quit modemu.
- %Rn
-
Control raw-mode.
-
- %R0
- Normal mode (*)
- %R1
- Raw mode. Modemu transmits every octet as received. Applied to both remote-to-modemu and modemu-to-remote direction. Override %B and %L settings.
-
- %Tstr
-
Control TELNET terminal-type option.
-
- %T0
- Refuse terminal-type option
- %T1
- Same as %T="$TERM" (TERM environment value is used) (*)
- %T=term[]
- Send term as the terminal-type if remote requests. The closing double quote can be omitted if no command follows.
-
- %Vn
-
Control verbose level.
%V0 (*) is the quietest, and adding following values to n lets
modemu
print more information to stderr.
-
- +1
- Print misc info to make up for less descriptive ATX0 indication
- +2
- Print TELNET option negotioation
-
ONLINE MODE
Modemu recognizes only the following command when in online mode.- wait +++ wait
- Escape to command mode. The `+++' must be input within the guard time. Wait is a period of time longer than the guard time without hitting any key. See also S2 and S12 register descriptions.
S REGISTERS
Only meaningful registers are listed here. Values in braces are default ones.- S2
- Escape character code. (43 = `+')
- S3
- Carriage return character code. (13)
- S4
- Line feed character code. (10)
- S5
- Backspace character code. (8)
- S7
- Connecting attempt time limit in seconds. (20)
- S12
- Escape sequence guard time in 50ths of a second. (50)
ENVIRONMENT VARIABLES
- MODEMU
- Initially evaluated as AT commands (before -e option argument is evaluated). Must have an `AT' or `at' prefix.
- TERM
- See %T1 command description.
AUTHOR
Toru Egashira ([email protected])BUGS
No dial-resriction, or blacklisting, capability. So using modemu maybe unlawful in some countries. B)