Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to Send AT Commands to mgetty? Post 302910439 by Perderabo on Thursday 24th of July 2014 12:51:45 PM
Old 07-24-2014
On my mgetty man page I see:

Code:
       -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?
This User Gave Thanks to Perderabo For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HELP: Need to send commands to Program

Hi, I am an absolute beginner in Unix and I need to send a commands to a program I have created a script that will let me login to the program, however, i cannot get the script to send commands to this program. When the cript logs into the program, the display/ prompt is as follows: 1>... (1 Reply)
Discussion started by: the_m4ch1ne
1 Replies

2. Shell Programming and Scripting

How to send AT commands after getting into Kermit window?

We're using Kermit 8.0.209 in Linux environment. We're trying to invoke kermit from an application, send some AT commands and receive the responses from the End terminals like mobiles/modems. We access these deivces through serial ports. For eg., to send a file we use command-line options like... (4 Replies)
Discussion started by: pratiul
4 Replies

3. Shell Programming and Scripting

Send one email with output result from 2 commands

Hi, i want to create a script which should do the following: 1) ping the remote servers and email the hosts which are down 2) netstat on port x on 2 server and email the result too. I want both results to be sent in the same email. I have few ideas but i can't finish it. Here... (4 Replies)
Discussion started by: varu0612
4 Replies

4. Shell Programming and Scripting

Make ssh and send commands

Hi, I'm trying to make an SSH into a SGSN node and collect some commands printouts.:confused: I really don't know how this can be done. I think it must be like this: #!/bin/bash ssh user@192.168.88.10 Then I must enter the password, but I don't know how to do it, I tried with: echo... (3 Replies)
Discussion started by: nagomes
3 Replies

5. Cybersecurity

Logging shell commands and send it out

Dear friends I'm looking for a solution to log all commands that users do in my RedHat box, and send it out to other remote server, Is there any guide for that Thanks ---------- Post updated at 04:20 AM ---------- Previous update was at 03:47 AM ---------- I can think of something else I... (7 Replies)
Discussion started by: reaky
7 Replies

6. Shell Programming and Scripting

Send Remote Commands via SSH with variables

Hi there I found the Command to send commands to other servers like: sv01> ssh user@sv02 'ps -ef' But I cant use Variables from a script i want to execute on another server like: sv01> ssh user@sv02 'cd $SCRIPTHOME' although the variable is set on sv01. How can I run commands on sv02 with... (2 Replies)
Discussion started by: DarkSwiss
2 Replies

7. Shell Programming and Scripting

can i send shell commands to a open window

i want to write a script that automatically fills in a form and pushes a few buttons. can i do that with bash or something similar? (1 Reply)
Discussion started by: magiling
1 Replies

8. Linux

send remote commands to windows machine?

hey guys, I've done some searching and other than winexe I haven't been able to find a way to send remote commands to a windows machine. The problem I get is with winexe whenever you send the process to the background in a script, I get the following error. :wall: Any help is appreciated! ... (0 Replies)
Discussion started by: terrell
0 Replies

9. SuSE

Starting mgetty with systemd?

Hello All, OS: openSUSE 13.1 (Bottle) (armv7hl) uname -a: Linux linux.site 3.14.14-cubox-i #1 SMP Sat Sep 13 03:48:24 UTC 2014 armv7l armv7l armv7l GNU/Linux So this is my first attempt at starting a service at boot with systemd. I've done this with inittab in the past, but I'm having... (0 Replies)
Discussion started by: mrm5102
0 Replies

10. UNIX for Dummies Questions & Answers

Mgetty Not Answering when Calling from Outside

Hello All, mgetty Version: 1.1.36 OS: OpenSuSE 13.1 (armv7l) Modem: Zoom 56K USB Modem Model 3095 So I've been playing with mgetty for weeks now testing dialing into the USB modem from another PC using the same modem and connecting using minicom (*minicom ---dials to---> mgetty). I had... (3 Replies)
Discussion started by: mrm5102
3 Replies
mgetty(8)                                                      mgetty+sendfax manual                                                     mgetty(8)

NAME
mgetty - smart modem getty SYNOPSIS
mgetty [options] ttydevice [gettydefs] DESCRIPTION
Mgetty is a ``smart'' getty replacement, designed to be used with hayes compatible data and data/fax modems. Mgetty knows about modem ini- tialization, manual modem answering (so your modem doesn't answer if the machine isn't ready), UUCP locking (so you can use the same device for dial-in and dial-out). Mgetty provides very extensive logging facilities. This manpage doesn't try to detail mgetty setup in detail, it just lists the most important options. For detailed instructions, see the info file mgetty.info (mgetty.texi). OPTIONS
-k <space> Tells mgetty to leave <space> kbytes free on disk when receiving a fax. -x <debug level> Use the given level of verbosity for logging - 0 means no logging, 9 is really noisy. The log file is usually /tmp/log_mg.<device> -s <speed> Set the port speed to use, e.g. "-s 19200". -r Tells mgetty that it is running on a direct line. UUCP locking is done, but no modem initialization whatsoever. -p <login prompt> Use the given string to prompt users for their login names. Various tokens are allowed in this string. These tokens are: @ for the system name, , , g, , v, f, for newline, carriage return, bell, backspace, vertical tab, form feed, and tab, respec- tively. P and L will expand to the tty name ("ttyS0"). Y will give the Caller ID, I the "CONNECT foobar" string returned by the modem, and S will output the port speed. s, m, V, R represent the operating system, the hardware name, the OS version, the OS release. N and U give the number of users currently logged in. C will be changed into the result of ctime(), and D and T will output the date and time, respectively. Finally, <digit> will use digit as octal/decimal/hexadecimal representation of the charac- ter to follow. The default prompt is specified at compile time. -n # Tells mgetty to pick up the phone after the #th RING. Default is 1. -R <t> Tells mgetty to go into "ringback" (aka "ring-twice") mode. That means: the first call is never answered, instead the caller has to hang up after the phone RINGs, wait 30 seconds, and then call again in the next <t> seconds for mgetty to pick up. If no call comes, mgetty will exit. I do not really recommend using this, better get a second phone line for the modem. -i <issue file> Output <issue file> instead of /etc/issue before prompting for the user name. The same token substitutions as for the the login prompt are done in this file. -D Tells mgetty that the modem is to be treated as a DATA modem, no fax initalization is attempted. -F Tells mgetty that DATA calls are not allowed and the modem should be set to Fax-Only. -C <class> Tells mgetty how to treat the modem. Possible values for <class> are "auto" (default, try to find out whether the modem supports fax), "cls2" (use the class 2 fax command set, even if the modem supports class 2.0), "c2.0" (use the class 2.0 fax command set), "data" (data only, exactly as the -D switch). -S <g3 file> If a call comes in and requests fax polling, mgetty will send the named file. Note: not all fax modems support poll sending. -I <fax id> Use the given fax station ID for fax identification. Not used for data modems. -b Open the port in blocking mode. Best used in combination with "-r". This is the default if mgetty is called as getty. You may want to use this if you want to make use of the two-device / kernel-locking scheme of the Linux and SunOS operating systems (/dev/ttyS.. and /dev/cua..). I do not recommend it, it's just include for completeness, and to be able to use mgetty as a full-featured getty replacement. -a Use autobauding. That is, after a connection is made, mgetty parses the "CONNECT foo" response code of the modem and sets the port speed to the first integer found after the "CONNECT" string, "foo" in this example. You need this if your modem insist on changing its DTE speed to match the line speed. I recommend against using it, better leave the port speed locked at a fixed value. The fea- ture is included because there exist old modems that cannot use a fixed (locked) port speed. -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' FILES
/etc/mgetty/mgetty.config Main configuration file. /etc/mgetty/login.config controls whether (and when) mgetty should call some other program for user login instead of /bin/login. How this is done is explained in this file. /etc/mgetty/dialin.config controls acceptance/denial of incoming calls based on the caller's number. Available only if you have "caller ID" and your modem supports it. /etc/nologin.ttyxx controls whether mgetty should pick up the phone upon incoming calls. If the file exists, calls are completely ignored. You can use this, for example, to stop mgetty during day time, and let it pick up at night only, by creating and removing /etc/nologin.ttyxx via the cron program at the appropriate time. /etc/issue will be printed after a connection is established, and before the with the '-i' option. /var/log/mgetty/mg_ttyxx.log Debug log file, see below. DIAGNOSTICS
If mgetty doesn't work the way it should, the main source of diagnostic data is the log file. It can be found in "/var/log/mgetty/mg_ttyxx.log" (for the mgetty process handling "ttyxx"). If it doesn't contain enough details, enhance the log level with the '-x' option to mgetty, e.g. "-x 5". Many of the common problems and solutions are discussed in the mgetty manual and the FAQ. Please see the WWW page at http://alpha.gree- nie.net/mgetty/ for both. BUGS
Not all of mgetty configuration can be done at run-time yet. Things like flow control and file paths (log file / lock file) have to be con- figured by changing the source and recompiling. Users never read manuals... SEE ALSO
g32pbm(1), sendfax(8), getty(8), mgettydefs(4), mgetty.info AUTHOR
mgetty is Copyright (C) 1993 by Gert Doering, <gert@greenie.muc.de>. greenie 27 Oct 93 - 21 Jul 98 mgetty(8)
All times are GMT -4. The time now is 09:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy