Author Topic: Communicating With Modem Through A Shell Script  (Read 1635 times)

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Communicating With Modem Through A Shell Script
« 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
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Communicating With Modem Through A Shell Script
« Reply #1 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.
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Communicating With Modem Through A Shell Script
« Reply #2 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
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Communicating With Modem Through A Shell Script
« Reply #3 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

datajerk

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • http://
Communicating With Modem Through A Shell Script
« Reply #4 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.

suruaZ

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Communicating With Modem Through A Shell Script
« Reply #5 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
SL-5500, Sharp ROM 3.13, Pretec GSM/GPRS CF, IBM Microdrive 340 MB

nilch

  • Hero Member
  • *****
  • Posts: 668
    • View Profile
    • http://
Communicating With Modem Through A Shell Script
« Reply #6 on: February 28, 2005, 10:48:20 am »
Here is the IPK for Expect.

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.
New no more-C1000 / 5000D (sold my 6000 and 750) | Cacko ROM 1.23 on C1000 | 256 MB CF | 2GB PNY SD card | Socket Networker WiFi CF Card | USB Host cable from StreamlineCPUS | Mini Microphone (for voice recording) |