Unfortunately googling the word 'chat' gives you zebedee billion responses that relate to everything and few of them refer to the linux chat command. I've read the man page and found a couple of examples but can't see how to do this.
I want to query the modem for it's manufacturer, product id and firmware version using AT commands. I can get the modem to respond as expected to the commands if initiated using chat, however I can't see how to get the response into a bash variable for me to work on it.
for example
gives me the onscreen response I am looking for, however using a RESPONSEVALUE=`chat....` just gives me an empty variable.
Google chat.c, there is a bsd version with a -r option for a report file, or you can add it. There is an inactive sourceforge file. Some versions send the dialog to syslog.
I want to query the modem for it's manufacturer, product id and firmware version using AT commands.
What function does 'chat' serve in this? You should just be able to talk to the modem.
...mine returns 'ERROR' because it's not a cellphone so AT+CGMI means nothing to it. It responds 'OK' to plain 'AT'. Works in BASH, KSH, and ASH. If you have trouble, try 'cat <&5' to see what it's printing.
Last edited by Corona688; 02-07-2011 at 05:42 PM..
Google chat.c, there is a bsd version with a -r option for a report file, or you can add it. There is an inactive sourceforge file. Some versions send the dialog to syslog.
The version I'm using is supposed to support the REPORT file, however I'll be darned if I can get it to work.....
If I could find any working examples I could at least try to see if my syntax is correct.....
for example..
gives me the response
However
gives me
I've tried variations on where to place the word REPORT without success.....it's annoying to be honest.
---------- Post updated at 01:29 PM ---------- Previous update was at 01:25 PM ----------
Quote:
Originally Posted by Corona688
What function does 'chat' serve in this? You should just be able to talk to the modem.
...mine returns 'ERROR' because it's not a cellphone so AT+CGMI means nothing to it. It responds 'OK' to plain 'AT'. Works in BASH, KSH, and ASH. If you have trouble, try 'cat <&5' to see what it's printing.
I had thought about going this way but the problem is that if the modem throws anything other then what's expected I could miss the error...for example (understandably) the normal response requires dropping the first two lines from read <&5 however if there's an error state I may never get to see it.
What I really want to do is capture all the response from the modem and then start to code the analysis of said response.
Thanks for the idea but hopefully you can see my concern.
You don't have to throw the output away, you know. I just did so to make the example small... As for capturing 'all' the output of the modem, it really doesn't tell you when it ends, so chat's not doing anything you can't. I still think common utilities are preferred over something so ossified it's undocumented and/or dropped by half the UNIX world..
If you want it to show up as whole whacks of text at once you can do this:
I simplified it a lot using features from ksh/zsh/bash, particularly functions and the exec 5<>/dev/ttyS0 which lets you read and write to the same FD.
---------- Post updated at 10:26 AM ---------- Previous update was at 10:00 AM ----------
this is kind of fun
Last edited by Corona688; 02-08-2011 at 12:17 PM..
Thanks for the ideas but I'm afraid the way you're suggesting doesn't work, not because of your code but instead the 'inconsistency' of the way the modem(s) outputs the data. Some insert line feeds or carriage returns at different places and it requires too much 'pre management' to account for all the variables.
I have found a sort of way to do it with chat, I cannot get REPORT to work and suspect it's the same problem as above, however by using the -v option the output gets pushed to the /var/log/messages logfile and I can pick up what I want from there.
So my last step is how to do the following....
The modem gets reset and as a result the 'timing' of when it comes back stable is variable. The only way I've identified to be certain it's back is an entry in the var/log/messages file that reads "now managed".
So what I wanted to do was something like....
I realise the above line won't work but has anyone previously written a bit of code that keeps reading /var/log/messages till a specific message comes up and then continue running the script?
Working on the badging system, Just found this old thread for 2006 and started reading it. ROTFL ... what a great discussion between forum members and our chat bot Gollum "back in the good old days"... You must check this out if you want a laugh and big smile:
... (1 Reply)
Hi,
I am trying to embed Skype or any other video chat/chat program into a webpage. Has anyone had success doing this? or know how?
Thanks
Phil (2 Replies)
Basically what i'm trying to do is execute an update command and at the same time have the system do a TCPdump to file for that update traffic.
So I would like to connect the two commands so that the tcpdump terminates automatically when the update finishes/fails/whatever.
Right now I have... (0 Replies)
Hi,
Could you please advice on the following query:
There are 2 users on a unix box:
1. aaaa
2. bbbb
I open 2 putty sessions and login with the above 2 users.
Then I type the following using the aaaa user to chat with bbbb.
talk bbbb
or
talk bbbb@hostname
Result: the screen goes... (4 Replies)
Hi,
Could you please advice on the following query:
There are 2 users on a unix box:
1. aaaa
2. bbbb
I open 2 putty sessions and login with the above 2 users.
Then I type the following using the aaaa user to chat with bbbb.
talk bbbb
or
talk bbbb@hostname
Result: the screen goes... (1 Reply)