I've had to learn how to communicate with modems via AT commands and the only guides and docs I've found for this effort involve launching a serial port reader like minicom and copying them there.
But this is difficult to automate. The approach I currently use is to list the AT commands in a file that we topped off using unix2dos
to add the CRLF endings and then I read and echo each line to the modem with an arbitrary sleep between each one.
This is not ideal because it isn't reliable and the script can't verify the success status of each of the commands. When something goes wrong we have no window to it. I know mmcli can do it, but that requires ModemManager to run in debug mode for some dumb reason which isn't desired. Is there a library or some other off the shelf software for issuing AT commands directly?
Yes, you are in luck, there exist my atinout program which is a command line tool to send AT commands to a modem and capture the responses it gets back. It can operate on stdin/stdout by giving
-
as file names:I have not tried but there should not be anything that prevents you from using pipes instead if that is more convenient.