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
TCPSER(1)						      General Commands Manual							 TCPSER(1)

NAME
tcpser - emulate a Hayes compatible modem SYNOPSIS
tcpser -d dev -s speed [-l log_level -t tracing_options] ... tcpser -v port [-l log_level -t tracing_options] ... DESCRIPTION
This manual page documents briefly the tcpser command. tcpser turns a PC serial port into an emulated Hayes compatible modem that uses TCP/IP for incoming and outgoing connections. It can be used to allow older applications and systems designed for modem use to operate on the Internet. tcpser supports all standard Hayes com- mands, and understands extended and vendor proprietary commands (though it does not implement many of them). tcpser can be used for both inbound and outbound connections. OPTIONS
A summary of options is included below. -h Show summary of options. -p Port to listen on (defaults to 6400). -t Trace flags: (can be combined) s modem input S modem output i IP input I IP output -l Log level: 0 (NONE), 1 (FATAL) - 7 (DEBUG_X) (defaults to 0). -L Log file (defaults to stderr). The following can be repeated for each modem desired (-s, -S, and -i will apply to any subsequent device if not set again): -d Serial device (e.g. /dev/ttyS0). Cannot be used with -v -v TCP port for VICE RS232 (e.g. 25232). Cannot be used with -d -s Serial port speed (defaults to 38400). -S Speed modem will report (defaults to -s value). -I Invert DCD pin. -n Add phone entry (number=replacement). -a Filename to send to local side upon answer. -A Filename to send to remote side upon answer. -c Filename to send to local side upon connect. -C Filename to send to remote side upon connect. -N Filename to send when no answer. -B Filename to send when modem(s) busy. -T Filename to send upon inactivity timeout. -i Modem init string (defaults to `', leave off `at' prefix when specifying). -D Direct connection (follow with hostname:port for caller, : for receiver). AUTHOR
tcpser was written by Jim Brain <brain@jbrain.com>. This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>, for the Debian project (but may be used by others). July 5, 2006 TCPSER(1)
All times are GMT -4. The time now is 03:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy