[mdlug] How to make minicom read AT commands from a file

Aaron Kulkis akulkis00 at gmail.com
Sun Mar 29 05:03:48 EDT 2009


Jay Nugent wrote:
> Greetings,
> 
> On Sat, 28 Mar 2009, Jonathan Billings wrote:
> 
>> On Sat, Mar 28, 2009 at 05:52:17PM -0400, R. Kannan wrote:
>>> Hello,
>>>
>>> I cannot find this in the minicom man page. I want minicom to read
>>> and send AT commands from a file to a serial port device (phone). I
>>> used to know this. Does anyone know how this can be done? 
>> This might not be the way you were doing it, but it should work:
>>
>> Hit C-a S (send file), choose 'ascii' and then choose the file with
>> the AT commands.
>>
>> There's actually a command for doing this kind of thing automatically,
>> called 'chat'.  It might sound familiar to folks who used linux with
>> dial-up networking because it was how a lot of people set up PPP and
>> SLIP dial-up.  It should be included with a distro's PPP packages.
> 
>    And inside CHAT, the thing that does the exchange of sending AT 
> commands and reading back the result codes ("OK") was a program called 
> EXPECT.

expect is an interpreted language, and is just called from inside CHAT.

man expect(1)

NAME
       expect - programmed dialogue with interactive programs, Version 5

SYNOPSIS
       expect [ -dDinN ] [ -c cmds ] [ [ -[f|b] ] cmdfile ] [ args ]

INTRODUCTION
       Expect is a program that "talks" to other interactive programs
       according  to  a  script.   Following the script, Expect knows
       what can be expected from  a  program  and  what  the  correct
       response  should be.  An interpreted language provides branch-
       ing and high-level control structures to direct the  dialogue.
       In  addition,  the user can take control and interact directly
       when desired, afterward returning control to the script.

       Expectk is a mixture of Expect and Tk.  It behaves  just  like
       Expect  and  Tk's wish.  Expect can also be used directly in C
       or C++ (that is, without Tcl).  See libexpect(3).

       The name "Expect" comes from the idea of send/expect sequences
       popularized  by uucp, kermit and other modem control programs.
       However unlike uucp, Expect is generalized so that it  can  be
       run as a user-level command with any program and task in mind.
       Expect can actually talk to several programs at the same time.

       For example, here are some things Expect can do:

              ?   Cause  your  computer to dial you back, so that you
                  can login without paying for the call.

              ?   Start a game (e.g., rogue) and if the optimal  con-
                  figuration  doesn't  appear,  restart it (again and
                  again) until it does, then  hand  over  control  to
                  you.

              ?   Run  fsck, and in response to its questions, answer
                  "yes", "no" or give control back to you,  based  on
                  predetermined criteria.

              ?   Connect  to another network or BBS (e.g., MCI Mail,
                  CompuServe) and automatically retrieve your mail so
                  that  it  appears  as  if it was originally sent to
                  your local system.

              ?   Carry environment variables, current directory,  or
                  any kind of information across rlogin, telnet, tip,
                  su, chgrp, etc.

       There are a variety of reasons why the  shell  cannot  perform
       these  tasks.   (Try,  you'll  see.)   All  are  possible with
       Expect.

   .....



More information about the mdlug mailing list