beralt / atinout Goto Github PK
View Code? Open in Web Editor NEWAtinout is a program that reads a list of AT commands.
Atinout is a program that reads a list of AT commands.
Use case:
AT+CMGF=1
OK
AT+CMGS=+31628870634
> This is the text message.โ
+CMGS: 45
OK
Line of code where it gets stuck:
do {
line = fgets(buf, (int)sizeof(buf), modem);
if (line == NULL) {
fprintf(stderr, "EOF from modem\n");
return EXIT_FAILURE;
}
strcpy(buf2, line);
strip_cr(buf2);
res = fputs(buf2, output);
if (res < 0) {
fprintf(stderr, "failed to write '%s' to output file (res = %d)\n", buf2, res);
return EXIT_FAILURE;
}
} while (! is_final_result(line));
DISCLAIMER: I am far from being a sw developer, just wanted to write my linux sms utility using this nice piece of code.
If the device expects to be written again then it will never provide the "end of transmission" hence the fgets keeps listening.
Using a serial terminal emulators you can see that (look at the usecase I have reported) and you (user) keep writing giving the expected terminator at the end (ascii 26 in my case).
I've written a C file for executing AT commands sequentially as soon as I hit "AT+CMGS=XXXXXXXXX" command the program gets stuck and waits for a user interrupt then when I press Ctrl+C it executes the next command.
strcpy(command, "echo 'AT' | atinout - /dev/ttyUSB0 -");
system(command);
strcpy(command, "echo 'AT+CMGF=1' | atinout - /dev/ttyUSB0 -");
system(command);
strcpy(command, "echo -e 'AT+CMGS=\"1234567890\"' | atinout - /dev/ttyUSB0 -");
system(command);
strcpy(command, "echo -e 'test messaget!!!!\x1A' | atinout - /dev/ttyUSB0 -");
system(command);
Why does it get stuck?
How can I execute the above commands sequentially without the need of an interrupt?
Is the problem with system command?
Regards.
Hi, could anyone provide proper Makefile to compile a package for OpenWrt?
Hi,
i having issues while running spesific command, it is for starting GPS track to my Sierra Modem, here is the output:
root@raspberrypi:/home/pi# echo -e 'AT!GPSTRACK=1,255,50,1000,1'|atinout - /dev/ttyUSB0 -
AT!GPSTRACK=1,255,50,1000,1Tracking initiated
OK
ATAaated
NO CARRIER
ATAaated
NO CARRIER
AATAaated
NO CARRIER
AAATAaated
NO CARRIER
AAAATAaated
NO CARRIER
AAAAATAaated
NO CARRIER
AAAAAATAaated
NO CARRIER
AAAAAAATAaated
NO CARRIER
AAAAAAAATAaated
NO CARRIER
AAAAAAAAATAaated
NO CARRIER
AAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAAAAATAaated
NO CARRIER
any help?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.