Reputation: 75
I'm trying to use atinout to send a simple AT command to my internal modem and while the command executes and displays the proper output of the AT command I sent, it does not return control back to my command prompt. I have to press CTRL+C to get back. I need to run this from a shell script, so I can't have it hang like this.
For example:
echo ATS0? | atinout - /dev/ttyS2 -
Output:
ATS0?
001
OK
At this point, I have to press CTRL+C to get back to the prompt.
I am running CentOS 6.7 with a US Robotics 56K Internal modem.
I downloaded the atinout RPM (atinout-0.9.1-1.1.x86_64.rpm) from the RPM PBone site.
Please help
Upvotes: 1
Views: 849
Reputation: 11
Some devices return "\n" instead of "\r\n" at the end of the response.
e.g. "OK\n" instead of "OK\r\n".
So you'd have to change the code to recognise the missing "\r" to make atinout work with those devices.
Upvotes: 1
Reputation: 21
I had the same problem, but I managed to solve it.
On my system, it needs a short break after writing the AT command and then reading.
Put the appropriate header in:
#include <unistd.h>
Insert usleep before the reading, and everything will be fine.
do {
usleep(10000);
line = fgets(buf, (int)sizeof(buf), modem);
Upvotes: 2