From 5c690589d62a64ce3a11307ddc9f57003d20e6dd Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Tue, 19 Jul 2022 23:32:52 +0300 Subject: [PATCH 1/2] Add missing dependency --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6173e82d..4fbda5cd 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CFLAGS ?= -W -Wall -Wextra -Werror \ -g LDFLAGS ?= -all: atinout +all: atinout atinout.1 atinout: atinout.c $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ From f4fb8d14d3c8cb136c69af041af500965ad4dd08 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Tue, 19 Jul 2022 23:59:43 +0300 Subject: [PATCH 2/2] Remove heavyweight dependency on ronn On Raspberry Pi OS installing ronn causes Puppet to fail with a "libfacter was not found" error. --- .gitignore | 2 - Makefile | 2 +- atinout.1 | 120 +++++++++++++++++++++++++ atinout.1.html | 235 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 356 insertions(+), 3 deletions(-) create mode 100644 atinout.1 create mode 100644 atinout.1.html diff --git a/.gitignore b/.gitignore index 2082e2eb..02a49064 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ .*.swp *.o atinout -atinout.1 -atinout.1.html atinout.spec diff --git a/Makefile b/Makefile index 4fbda5cd..6173e82d 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CFLAGS ?= -W -Wall -Wextra -Werror \ -g LDFLAGS ?= -all: atinout atinout.1 +all: atinout atinout: atinout.c $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ diff --git a/atinout.1 b/atinout.1 new file mode 100644 index 00000000..ac8337f3 --- /dev/null +++ b/atinout.1 @@ -0,0 +1,120 @@ +.\" generated with Ronn-NG/v0.9.1 +.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 +.TH "ATINOUT" "1" "July 2022" "" +.SH "NAME" +\fBatinout\fR \- Send AT commands to modem, capturing the response +.SH "SYNOPSIS" +\fBatinout\fR \fIinput_file\fR|\fB\-\fR \fImodem_device\fR \fIoutput_file\fR|\fB\-\fR +.br +\fBatinout\fR \fB\-\-version\fR +.br +\fBatinout\fR \fB\-\-usage\fR +.br +\fBatinout\fR \fB\-\-help\fR +.br +.SH "DESCRIPTION" +\fBAtinout\fR 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\. +.P +Notice that \fBatinout\fR is strictly about sending AT commands only; it cannot be used for AT commands that expect additional input data (e\.g\. AT+CMGS etc)\. +.SH "FILES" +\fBAtinout\fR expects \fIinput_file\fR to be a list of AT command to be run\. If the file name \fB\-\fR is used then standard input is read\. +.P +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\. +.P +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\. +.P +The modem is identified with \fImodem_device\fR (e\.g\. /dev/ttyS0 (COM1), /dev/ttyACM0 (USB phone serial interface), \|\.\|\.\|\.)\. No serial configuration (e\.g\. speed, parity) is done before opening the device\. +.P +The responses from the AT commands are written to \fIoutput_file\fR, or standard output if the file name \fB\-\fR is given\. +.SH "OPTIONS" +The following list of options are supported: +.TP +\fB\-h\fR, \fB\-\-help\fR +Prints explanation and gives an example on usage\. +.TP +\fB\-\-usage\fR +Prints information about arguments and options\. +.TP +\fB\-\-version\fR +Print version information\. If this is the only option given, also prints copyright/licensing information\. +.SH "EXAMPLES" +Check that the modem is connected and alive\. +.IP "" 4 +.nf +$ echo AT | atinout \- /dev/ttyACM0 \- +AT +OK +$ +.fi +.IP "" 0 +.P +Hang up any calls\. +.IP "" 4 +.nf +$ echo ATH | atinout \- /dev/ttyACM0 \- +ATH +OK +$ +.fi +.IP "" 0 +.P +Query how many entries the phone book has for ME storage\. +.IP "" 4 +.nf +$ echo 'AT+CPBS="ME"; +CPBR=?' | atinout \- /dev/ttyACM0 \- +AT+CPBS="ME"; +CPBR=? + ++CPBR: (1\-7000),80,62 + +OK +$ +.fi +.IP "" 0 +.P +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\. +.IP "" 4 +.nf +$ cat > save\-phonebooks <,,,,[,,[,[,]]] + +# 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 +$ +.fi +.IP "" 0 +.SH "ENVIRONMENT" +No environmental variables are used\. +.SH "BUGS" +\fBAtinout\fR does not support reading response lines longer than 4095 characters\. +.P +\fBAtinout\fR does not do any serial port configuration, it just opens the device as is\. +.SH "COPYRIGHT" +Atinout is Copyright (C) 2013 Håkon Løvdal \fIhlovdal@users\.sourceforge\.net\fR +.SH "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) diff --git a/atinout.1.html b/atinout.1.html new file mode 100644 index 00000000..596ef82a --- /dev/null +++ b/atinout.1.html @@ -0,0 +1,235 @@ + + + + + + atinout(1) - Send AT commands to modem, capturing the response + + + + +
+ + + +
    +
  1. atinout(1)
  2. +
  3. +
  4. atinout(1)
  5. +
+ + + +

NAME

+

+ atinout - 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 if 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.

+ + + +

Atinout is Copyright (C) 2013 Håkon Løvdal hlovdal@users.sourceforge.net

+ +

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)

+ +
    +
  1. +
  2. July 2022
  3. +
  4. atinout(1)
  5. +
+ +
+ +