How to Send AT Commands to mgetty?

Hello All,

I've been working on something which requires a dialup USB Modem. I have been using minicom with success entering "AT Commands" directly into
the terminal window that shows after running the minicom command. I had already configured the modem through minicom and was able to successfully
call into the USB Modem and hear the dialup connection tone.

But I am now trying to use mgetty to do the same, but I cannot figure out where to enter the AT Commands. I found a few different sites that talk about
using mgetty along with AT Commands but I cannot figure out WHERE these commands are entered. In minicom, I simply run the minicom command, then
when the terminal window refreshes and it shows the minicom terminal I can simply type the command directly into the window there and hit enter and it takes the
command. But mgetty, if I try the same thing nothing happens after entering the command so I'm assuming there is another way...?

I know mgetty is supposed to be started through init tab, so are you supposed to create a "script" like file for passing commands to the modem with mgetty?
I also read something about "init-chat", and how that is used to send command sequences to the modem, but don't know where to use them...?

If anyone has any ideas or suggestions on how to do this, or if anyone can point my in the direction of a tutorial for how to do this, that would be
greatly appreciated.

EDIT: As I'm writing this I was re-reading the manual page for mgetty and came across "mgettydefs", is this what I am looking for...?

Thanks in Advance,
Matt

On my mgetty man page I see:

       -m 'expect send ...'
              Set the "chat sequence" that is used to initialize the modem. For an empty expect part, use empty double
              quotes  ("").  Since  the  sequence contains spaces, you have to enclose all of it in single quotes('').
              Example:

              mgetty -m '"" ATH0 OK'

Don't you also have "-m"? I have never used mgetty and I probably never will. I don't have a modem either. But for years I used modems on Unix with getty and its file gettydefs so this seems very familiar. mgettydefs is used to configure the port. getty was (and I assume the mgetty is) intended to set things up so the system is ready to accept an incoming call.

We did not have a great way to send AT command sto the modem on the fly. Instead we would program the modem via AT commands and the modem would simply remember it's configuration somehow. Once in a blue moon we might need to reprogram a modem, but in general this never occurred.

I have not seen a modem for a long time. I would hope that modern modems (if they exist) can remember their configuration. If your modem is dropping its config on a regular basis, maybe it need a new battery for its memory or something like that.

As I type this in, more memories are returning. I wonder if that is a good thing... We had a few modems that would "swing both ways". That is we used them both for outgoing and incoming calls. The getty would program the port (say, /dev/tty01) via gettydefs to use modem control. The getty program would issue an open() system call which would block waiting for a signal from the modem (DCD, data carrier detect or DSR, data set ready, not sure which). This signal would not arrive until the modem answered an incoming call. Meanwhile we could use programs like uucico or cu to place outgoing calls. They would open the port with no modem control and thus the open would succeed immediately. They had ways to send AT commands and this was always needed since we had to do ATDT7035551212 or something like that to tell the modem which phone number to call. Because cu or uucico had opened the port, that getty open was now blocked because another process has the port. When the modem control signal arrived the getty open stayed blocked. When cu or uucico was finished, it would put the modem back in the state in which it found it and close the port. Now it was ready to answer an incoming call again and that waiting open(0 call issued long ago by getty was still valid.

I don't know how much of this is useful to you. If you still need help, reveal a few clues so someone can help you. What version of what OS? What system? What modem?

Hey Perderabo, thanks for the reply, very much appreciated!

I apologize for not responding to your post, but I had gotten pulled off this thing with mgetty that I was working on
and am just coming back around to it now... Again sorry for not getting back to you sooner.

Humm... Oh ok, when I had read the man page I guess I didn't put it together that the -m option for the initialization
string was where you would enter those commands. Doohh!!

And I guess I didn't see the AT Command example they use right below that -m option's section, which showed:

       -m 'expect send ...'
              Set the "chat sequence" that is used to initialize the modem. For an empty expect part,  use  empty  double  quotes
              (""). Since the sequence contains spaces, you have to enclose all of it in single quotes(''). Example:

              mgetty -m '"" ATH0 OK'

Basically, I will be connecting to this USB Modem over the phone network from my PC to a computer in a remote
location (*which will contain the USB Modem). In my successful tests, I used Minicom on my PC (*the client) and
dialed the Modems Telephone number (*using ATD55555...), then on the server side (*the computer with the USB
Modem) would be running mgetty and would answer the incoming call from my PC and I would then be
prompted with a login prompt from the server-side's computer. And after logging in I get that server's Console/CLI.

Modem: Zoom 56k USB Modem (*Model 3095) - which works great BTW...
Computer w/ USB Modem:CuBox-i, running OpenSuSE 13.1 *for ARMv7

The ONLY thing I'm really having trouble with now is trying to get mgetty to start-up at boot time. OpenSuSE 13.1 uses
systemd instead of inittab which is where I am used to starting things during boot. When I test mgetty from the CLI
and I watch it's log file (*/var/log/mgetty.ttyACM0) even though it's working when I run it from the CLI, I can see in
the log that it says:

So now I'm trying to figure out how to use systemd since this is my 1st time attempting to use it. So far as I can tell
I need to have some kind of mgetty.service file located in /etc/systemd/system/*.... But it's starting to get a little
confusing with the .conf, .target and .service files...

Do you have any experience creating your own custom systemd files to start a program during boot?

Again, thanks alot for your reply it is much appreciated, and I apologize for taking so long to get back to you...

Thanks Again,
Matt