Script for AT command

Hi all,
How write a script for send AT commando to modem?
I can use only Screen but i don't have Minicom on my embedded board:

Is possible run Screen and after write AT command like:

AT+CGREG
AT!PADCONF?1
....etc..

PS:how install minicom for a board with ARM? i must compiling source?
i know that minicom have a script
thanks for your help
Regards

Sorry, but this post is not easy to understand because there is no detail or context and the post is written in strange English.

Assuming this is the product supplier you are talking about, have you tried contacting the supplier at http://www.minicom.com/ ?
KVM over IP � Switches & Extender � Minicom

I mean MINICOM on Linux! http://alioth.debian.org/projects/minicom

I can use Screen for send AT commands with a script?
thanks

Sorry, I know a lot about modem control strings but nothing about this product. Suggest you contact the authors.

For those in the UK, I first read this post as being about the Minicom you see on Post Office counters:
Telecommunications device for the deaf - Wikipedia, the free encyclopedia

You fool me?

Definitely not.

It is not possible to post suitable unix Script solution based the detail you have posted. We have no idea what "Screen" is or any details about your computer hardware or its Operating System or the modem. Any modem commands would have to be sent to a modem port on your computer.

The Minicom for Linux program is interesting, but still ancient technology. What real-world problem are you trying to solve?

Still suggest that you contact the authors of the software for advice. If you have trouble with scripting the solution please post as much detail as you can complete with lots and lots of detail and examples.

Afterthought:

If the O/P does not have modem software is is easy to write AT commands directly to the modem port. We'd need to know the Linux name for the modem port /dev/.... and what Operating System and Shell the O/P has. The process writing to the modem must not add extra characters, so we need to avoid sending a line terminator.

# A sort of solution in a Bourne-type Shell might be:
echo -n "AT+CGREG" > /dev/<name of the device>
echo -n "AT!PADCONF?1" > /dev/<name of the device>
#Or if it's the other syntax for echo on whatever O/S the O/P has:
echo "AT+CGREG\c" > /dev/<name of the device>
echo "AT!PADCONF?1\c" > /dev/<name of the device>

Hi,
on my board i have only u-boot, kernel and rootfs! I haven't a Gui interface..
The modem is the SL8092 which is connected to the card via USB port /dev/ttyUSB3.
Screen is a program like minicom.

I have write this script on my PC with UBUNTU 11.10 and modem plugged:

modem.sh:

#! /bin/bash
#Or if it's the other syntax for echo on whatever O/S the O/P has:
echo "AT+CGREG\c" > /dev/ttyUSB3
echo "AT!PADCONF?1\c" > /dev/ttyUSB3

but when i run sh modem.sh:

giuseppe@giuseppe-K53SV:~/Scrivania$ sh modem.sh
giuseppe@giuseppe-K53SV:~/Scrivania$

I not have answers.

Should look OK!!!!!!!!!!!!

thanks
regards

Didn't realise at first that this is a USB modem.

There is a mention on this site about the syntax for screen .
Sierra Sl8092 modem driver and MINICOM are not present, how to do? - IMXCommunity.org
Actually that site is more for people with non-standard kit.

screen /dev/ttyUSB0 115200
at
OK
AT+cgreg?
OK

i now want a script that send AT commands and i want view the answers.

Remember that we know nothing about this screen command .

First thing I'd try (assuming you have the "echo" without the -n switch) is to see if the screen command will take typeahead:

echo "AT\c" | screen /dev/ttyUSB0 115200

giuseppe@giuseppe-K53SV:~/Scrivania$ echo "AT\c" | screen /dev/ttyUSB3 115200
Must be connected to a terminal.
giuseppe@giuseppe-K53SV:~/Scrivania$

I can use Bash command like echo, chat, cat, etc..

Sounds like you need an alternative program to screen if you want to automate this.
If you have the Linux script command that might be able to control the screen session.

yes i have script. how i might control the screen session?

I wrote this a while ago to interact with a serial modem, it might work for you, or might not. It should at least do the CR-NL translation and such by messing with stty. If the subroutine doesn't work, you can rip out the stty and exec bits and talk to the modem how you please through FD 5.

#!/bin/bash

function get_response
{
        local ECHO
        # cat will read the response, then die on timeout
        cat <&5 >$TMP &
        echo "$1" >&5
        # wait for cat to die
        wait $!

        exec 6<$TMP
        read ECHO <&6
        if [ "$ECHO" != "$1" ]
        then
                exec 6<&-
                return 1
        fi

        read ECHO <&6
        read RESPONSE <&6
        exec 6<&-
        return 0
}


stty -F /dev/ttyUSB3 115200 -echo igncr -icanon onlcr ixon min 0 time 5

# Open modem on FD 5
exec 5<>/dev/ttyUSB3

get_response "AT" || echo "Bad response"
echo "Response was '${RESPONSE}'"       ;       cat $TMP

exec 5<&-

i not have exec program

Yes you do. It's a shell builtin, positively any kind of Bourne shell has it. Try this:

# Open file into FD 5
exec 5</etc/passwd
# Read from FD 5 and print it to the screen
cat <&5
# close FD 5
exec 5<&-

Not all shells support <> with exec, but bash certainly does. ksh and zsh too if I'm not mistaken.