How to show output from a modem?
All:
How does one show the output from a modem onto the screen? I am using bourne-again shell and want to
write a script which shows the output from a modem based upon my input to said modem.
Here is the first line:
echo 'ATZ' < /dev/modem
How would I print out the output to the screen? Thank you.
Keith
Re: How to show output from a modem?
On Thu, 27 Mar 2008 07:28:52 -0400, Keith Lee <cmarvel2000@yahoo.com> wrote:
[color=blue]
> How would I print out the output to the screen? Thank you.[/color]
Output is quite messy. Make sure nothing else is using the modem, and no other
cat processes are running (trap the pid of the cat command, and use thatin the
kill, if other cat processes are running).
#!/bin/bash
cat /dev/modem &
echo "AT&F" > /dev/modem
sleep 2
echo "ATS11=50" > /dev/modem
sleep 2
echo "AT%C0%E1E1W4&S0S0=0S7=60S11=60S30=0C1+DS=3,0;&V+DS44=3,0;+VCID=1;+ES=3,0,2" > /dev/modem
sleep 2
killall cat
Note the commands I'm sending to the modem are the same as I use in the kppp
initialization of the modem.
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
Re: How to show output from a modem?
On Thu, 27 Mar 2008 06:28:52 -0500, Keith Lee wrote:
[color=blue]
> All:
> How does one show the output from a modem onto the screen? I am using
> bourne-again shell and want to
> write a script which shows the output from a modem based upon my input
> to said modem.
> Here is the first line:
>
> echo 'ATZ' < /dev/modem
>
> How would I print out the output to the screen? Thank you.
>
> Keith[/color]
Assuming you are wanting the response strings, use a term program like
minicom or the one in kppp.
BTW, I don't think the above will send ATZ to the modem. Change < to >. To
test, send ata, and see if it goes into answer mode.
echo ata > /dev/ttySx
where x is the port the modem is on, or /dev/modem if you are sure that
the symlink is correct, and really there. Of course verbose responses need
to be enabled in the modem. Usually e1 and normally default iirc.
--
Want the ultimate in free OTA SD/HDTV Recorder? [url]http://mythtv.org[/url]
My Tivo Experience [url]http://wesnewell.no-ip.com/tivo.htm[/url]
Tivo HD/S3 compared [url]http://wesnewell.no-ip.com/mythtivo.htm[/url]
AMD cpu help [url]http://wesnewell.no-ip.com/cpu.php[/url]
Re: How to show output from a modem?
David W. Hodgins wrote:
[color=blue]
> On Thu, 27 Mar 2008 07:28:52 -0400, Keith Lee <cmarvel2000@yahoo.com> wrote:
>[color=green]
>> How would I print out the output to the screen? Thank you.[/color]
>
> Output is quite messy. Make sure nothing else is using the modem, and no
> other cat processes are running (trap the pid of the cat command, and use
> that in the kill, if other cat processes are running).
>
> #!/bin/bash
> cat /dev/modem &
> echo "AT&F" > /dev/modem
> sleep 2
> echo "ATS11=50" > /dev/modem
> sleep 2
> echo
> "AT%C0%E1E1W4&S0S0=0S7=60S11=60S30=0C1+DS=3,0;&V+DS44=3,0;+VCID=1;+ES=3,0,2"[color=green]
> > /dev/modem sleep 2 killall cat[/color]
>
> Note the commands I'm sending to the modem are the same as I use in the kppp
> initialization of the modem.
>
> Regards, Dave Hodgins
>[/color]
I was thinking about what you wrote there... what if you replaced
cat /dev/modem &
with
tail -f /dev/modem &
would it work? I'm thinking that cat would only show the 1st response but tail
would continue to show the next and the next etc.
I dont have a modem or I'd try it, i always found serial port/modem stuff to
be fun to mess with. I wrote a complete, from scratch, modem com program for
dos once, with loopback capabilities, file output etc, very enjoyable
project.
Eric
Re: How to show output from a modem?
On Thu, 27 Mar 2008 15:14:51 -0400, Eric <Scorpus@gordinator.org> wrote:
[color=blue]
> I was thinking about what you wrote there... what if you replaced
> cat /dev/modem &
> with
> tail -f /dev/modem &[/color]
I actually tried both, before I posted. The tail doesn't work, as it is
looking for a change in the location of the end of file, which it never
finds. The cat does work, but seems to generate a lot of blank line
output, hence the comment about it being messy. Obviously a proper
terminal program that handles interrupts is the best way to go, but
for quick & dirty access from a script, the cat & echo commands do
work, provided the sleep commands in between the echo commands are
long enough.
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
Re: How to show output from a modem?
Keith Lee <cmarvel2000@yahoo.com> writes:
[color=blue]
>All:
> How does one show the output from a modem onto the screen? I am using bourne-again shell and want to
>write a script which shows the output from a modem based upon my input to said modem.
> Here is the first line:[/color]
[color=blue]
>echo 'ATZ' < /dev/modem[/color]
Since that tell echo to read its input from the modem, it will not work
very well
Anyway why not use minicom, and type in what you want.
[color=blue]
> How would I print out the output to the screen? Thank you.[/color]
[color=blue]
>Keith[/color]
Re: How to show output from a modem?
Eric <Scorpus@gordinator.org> writes:
[color=blue]
>David W. Hodgins wrote:[/color]
[color=blue][color=green]
>> On Thu, 27 Mar 2008 07:28:52 -0400, Keith Lee <cmarvel2000@yahoo.com> wrote:
>>[color=darkred]
>>> How would I print out the output to the screen? Thank you.[/color]
>>
>> Output is quite messy. Make sure nothing else is using the modem, and no
>> other cat processes are running (trap the pid of the cat command, and use
>> that in the kill, if other cat processes are running).
>>
>> #!/bin/bash
>> cat /dev/modem &
>> echo "AT&F" > /dev/modem
>> sleep 2
>> echo "ATS11=50" > /dev/modem
>> sleep 2
>> echo
>> "AT%C0%E1E1W4&S0S0=0S7=60S11=60S30=0C1+DS=3,0;&V+DS44=3,0;+VCID=1;+ES=3,0,2"[color=darkred]
>> > /dev/modem sleep 2 killall cat[/color]
>>
>> Note the commands I'm sending to the modem are the same as I use in the kppp
>> initialization of the modem.
>>
>> Regards, Dave Hodgins
>>[/color][/color]
[color=blue]
>I was thinking about what you wrote there... what if you replaced
>cat /dev/modem &
>with
>tail -f /dev/modem &[/color]
Nope cat is teh right command.
[color=blue]
>would it work? I'm thinking that cat would only show the 1st response but tail[/color]
You think wrongly.
[color=blue]
>would continue to show the next and the next etc.
>I dont have a modem or I'd try it, i always found serial port/modem stuff to
>be fun to mess with. I wrote a complete, from scratch, modem com program for
>dos once, with loopback capabilities, file output etc, very enjoyable
>project.
>Eric[/color]