Sponsored Content
Operating Systems Linux How do I capture responses from the chat command? Post 302494568 by Corona688 on Monday 7th of February 2011 04:36:41 PM
Old 02-07-2011
Quote:
Originally Posted by Bashingaway
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.

Code:
#!/bin/sh
# set up modem device to translate outgoing \n into \r\n
stty -F /dev/ttyS0 9600 -echo igncr icanon onlcr
# Open modem for reading and writing
exec 5</dev/ttyS0
exec 6>/dev/ttyS0

echo "AT+CGMI" >&6

# Eat the echo, then eat the blank line
read <&5 ; read <&5
# Read the actual response
read RESPONSE <&5

echo "Response was $RESPONSE"

# close the files
exec 5<&-
exec 6>&-

Code:
$ ./modem.sh
Response was ERROR
$

...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..
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

talk command to chat

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)
Discussion started by: miltonkeynesguy
1 Replies

2. UNIX for Dummies Questions & Answers

talk command to chat

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)
Discussion started by: miltonkeynesguy
4 Replies

3. UNIX for Dummies Questions & Answers

Doing a capture while another command is executing?

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)
Discussion started by: MrEddy
0 Replies

4. Web Development

Can you embed Skype or any other video chat/chat program into a webpage?

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)
Discussion started by: phil_heath
2 Replies

5. What is on Your Mind?

Very Funny and Somewhat Amazing 2006 Chat Bot Chat

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)
Discussion started by: Neo
1 Replies
Sendpage::Modem(3pm)					User Contributed Perl Documentation				      Sendpage::Modem(3pm)

NAME
Sendpage::Modem.pm - extends the Device::SerialPort package SYNOPSIS
$modem=Sendpage::Modem->new($params); $modem->init($baud,$parity,$data,$stop,$flow,$str); $modem->ready($functionname); $modem->dial($areacode,$phonenumber,$timeout); $modem->chat($send,$resend,$expect,$timeout,$retries,$dealbreaker, $carrier); $modem->hangup(); $str=Sendpage::Modem->HexStr("tab: cr: "); DESCRIPTION
This is a module for use in sendpage(1). BUGS
This needs more docs. AUTHOR
Kees Cook <kees@outflux.net> SEE ALSO
perl(1), sendpage(1), Sendpage::KeesConf(3), Sendpage::KeesLog(3), Sendpage::PagingCentral(3), Sendpage::PageQueue(3), Sendpage::Page(3), Sendpage::Recipient(3), Sendpage::Queue(3) COPYRIGHT
Copyright 2000-2003 Kees Cook. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2008-01-03 Sendpage::Modem(3pm)
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy