OESF Portables Forum

General Forums => General Discussion => Topic started by: suruaZ on February 27, 2005, 09:16:52 am

Title: Communicating With Modem Through A Shell Script
Post by: suruaZ on February 27, 2005, 09:16:52 am
Hello,

Is there a way to communicate with modem (send commands and receive answers) from a shell script? I want to automate some typing in minicom.

Thanks,
suruaZ
Title: Communicating With Modem Through A Shell Script
Post by: iamasmith on February 27, 2005, 10:13:12 am
As minicom would have the port locked for use whilst running your only option would be to use the features (if any) of minicom.
Title: Communicating With Modem Through A Shell Script
Post by: suruaZ on February 27, 2005, 10:51:35 am
Quote
As minicom would have the port locked for use whilst running your only option would be to use the features (if any) of minicom.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=68766\"][{POST_SNAPBACK}][/a][/div]

Interesting but seems port is not locked. When minicon is opened and I have typed something like: echo "atd12345" > /dev/ttyS3 in other console it appeared in the minicom window (but I need to press enter to finish the command).
Anyway I'm going to use the shell script without minicom running. So the question is still remains.

suruaZ
Title: Communicating With Modem Through A Shell Script
Post by: ScottYelich on February 28, 2005, 09:44:11 am
without getting into the nitty gritty about having both sides of the serial speaking the "same language" (ie: data bits, stop bots, parity, flow control (hw/sw), etc.) -- if the serial port
and the modem are speaking the same language, then you can open the serial port
for reading/writing as any other file.

Scott
Title: Communicating With Modem Through A Shell Script
Post by: datajerk on February 28, 2005, 10:17:08 am
If you want to automate typing look at Expect.  Expect will launch minicom and monitor your input and output and then assist as needed.
Title: Communicating With Modem Through A Shell Script
Post by: suruaZ on February 28, 2005, 10:34:48 am
Quote
If you want to automate typing look at Expect.  Expect will launch minicom and monitor your input and output and then assist as needed.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=68851\"][{POST_SNAPBACK}][/a][/div]

Could you provide some links please. I never heard about Expect. What is it?

Thanks,
suruaZ
Title: Communicating With Modem Through A Shell Script
Post by: nilch on February 28, 2005, 10:48:20 am
Here is the IPK for Expect. (http://bryandeluca.com/cacko/feed/expect_5.32.2-5_arm.ipk)

Expect is a unix tool to automatically enter parameters or user inputs without the user having to actually enter the input - but autmated.

So if your program at a particular pint reqwuired the user to press 'Y' to continue - you can make expect enter the 'Y' at the appropraite point in the program flow.
So if a program (or shell script) is 'expecting' an input, expect provides the input based on user definition.