LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-07-2014, 10:55 AM   #1
czardragon
LQ Newbie
 
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
Linux Chat - Handling Errors via Subexpect Pairs


Good morning,

I'm still very new to Linux, and am writing a script that needs to connect to possibly several different modem models.

I want to disable 4g on modems that support that mode. As such, I would have a set of lines like this:

Code:
''      'ATZ'
'OK' 'AT+4GMODE=0'  #disable the 4g mode, where supported
So since not all modems will support that command, the next line would be use a subexpect clause:

Code:
'OK-AT-OK' 'ATDT#12345678" #dummy phone number of course
'CONNECT'
My expectation is that the 4g disable would return 'OK' where supported, otherwise would return 'ERROR'. To handle that 'ERROR' the chat would send 'AT' and expect 'OK'.

This works for connecting a modem that supports the 4g command. However, for a 3g-only modem, it breaks. I've got a tool that allows me to send commands manually to the modem and check the response. For both modems, AT does return OK.

Do the subexpect/subsend pairs not work to handle a returned ERROR, then?

I apologize if this is in the wrong forum...I thought about the networking forum, but since I'm still very new I thought maybe I'm missing something that would be obvious to experienced users. I've looked at the man page for chat, but did not see anything that sheds light on this. I searched this forum and found one other old thread with a similar problem, but I still can't figure out where mine is going wrong.

Thanks and have a great day!
 
Old 05-15-2014, 02:36 AM   #2
Andy Alt
Member
 
Registered: Jun 2004
Location: Minnesota, USA
Distribution: Slackware32-stable, Debian32 stable, LFS 7.1
Posts: 385

Rep: Reputation: 44
I'm not familiar with chat scripting, but I believe I've found an appropriate reference page.
http://www.tldp.org/HOWTO/PPP-HOWTO/x1219.html

May I ask what you are using for documentation?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows chat client communicates with Linux server chat application friend511 Linux - Newbie 1 05-16-2012 07:56 AM
Handling Errors and exceptions of commands pdklinux79 Linux - Newbie 1 06-20-2008 03:28 PM
errors while handling sys_unlink dypgrp Linux - General 0 02-01-2005 10:57 AM
linux file handling errors class_struggle Linux - Newbie 1 07-26-2004 06:31 PM
Exception handling compilation errors ashwinipahuja Programming 6 07-03-2004 07:46 AM


All times are GMT -5. The time now is 12:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration