atinout - Man Page

Send AT commands to modem, capturing the response

Synopsis

atinout input_file|- modem_device output_file|-
atinout --version
atinout --usage
atinout --help

Description

Atinout reads a list of AT commands. It sends those commands one by one to the modem, waiting for the final result code for the currently running command before continuing with the next command in the list. The output from the commands is saved.

Notice that atinout is strictly about sending AT commands only; it cannot be used for AT commands that expect additional input data (e.g. AT+CMGS etc).

Files

Atinout expects input_file to be a list of AT command to be run. If the file name - is used then standard input is read.

Although the above states a list of AT commands it is actually not just a list of command but more generally a list of AT command lines. However the rest of the man page will just refer to AT commands; running several commands in one command line offers no benefits, and if one of them fails you have no idea of which one failed. So unless maybe for a single run on the command line (see Examples), I recommend against putting more than one command on each command line.

And if the distinction between AT command and AT command line was not something you were deeply familiar with you should read the ITU V.250 specification about AT commands. In fact, unless you already have read V.250 before, you absolutely should go to http://www.itu.int/rec/T-REC-V.250-200307-I/en and do so right away.

The modem is identified with modem_device (e.g. /dev/ttyS0 (COM1), /dev/ttyACM0 (USB phone serial interface), ...). No serial configuration (e.g. speed, parity) is done before opening the device.

The responses from the AT commands are written to output_file, or standard output i the file name - is given.

Options

The following list of options are supported:

-h, --help

Prints explanation and gives an example on usage.

--usage

Prints information about arguments and options.

--version

Print version information. If this is the only option given, also prints copyright/licensing information.

Examples

Check that the modem is connected and alive.

$ echo AT | atinout - /dev/ttyACM0 -
AT
OK
$

Hang up any calls.

$ echo ATH | atinout - /dev/ttyACM0 -
ATH
OK
$

Query how many entries the phone book has for ME storage.

$ echo ´AT+CPBS="ME"; +CPBR=?´ | atinout - /dev/ttyACM0 -
AT+CPBS="ME"; +CPBR=?

+CPBR: (1-7000),80,62

OK
$

Backup all phone numbers. This will most likely not be the same as a full backup of all contact information, but at least the names and numbers are saved which is the most vital information.

$ cat > save-phonebooks <<EOF
AT+CSCS="UTF-8"
AT+CGMI
AT+CGMR
AT+CPBS="SM"
AT+CPBR=1,240
AT+CPBS="ME"
AT+CPBR=1,7000
EOF
$ atinout save-phonebooks /dev/ttyACM0 phonebook_backup.`date "+%Y-%m-%d_%H-%M"`
$

List current calls. The information text format is (see 27.007 for details):

+CLCC: <id1>,<dir>,<stat>,<mode>,<mpty>[,<number>,<type>[,<alpha>[,<priority>]]]

# No active calls
$ echo AT+CLCC | atinout - /dev/ttyACM0 -
AT+CLCC
OK
$

# One active call
$ echo AT+CLCC | atinout - /dev/ttyACM0 -
AT+CLCC
+CLCC: 1,0,3,0,0,"0123456789",129,"",0

OK
$

Environment

No environmental variables are used.

Bugs

Atinout does not support reading response lines longer than 4095 characters.

Atinout does not do any serial port configuration, it just opens the device as is.

See Also

V.250 (http://www.itu.int/rec/T-REC-V.250-200307-I/en), 27.007 (http://www.3gpp.org/ftp/Specs/html-info/27007.htm), 27.005 (http://www.3gpp.org/ftp/Specs/html-info/27005.htm)

Info

September 2013