LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-03-2015, 10:36 AM   #1
rpbulls
LQ Newbie
 
Registered: Jul 2015
Posts: 8

Rep: Reputation: Disabled
Reading from serial port - initial string is what I write to it.


All,
I have a modem hooked up on a serial port through a usb->serial interface.
I've been able to open a port, send a command (using the "write" on /dev/ttyUSB0) and read the response (using "read" port).
However, I notice that the first read response that is captured on the port using the "read" is actually the original command I send using the "write".
Can someone help explain why I see this behavior? Also, how do I fix it so I don't read the command that I'm sending out?
Thx...
 
Old 08-03-2015, 10:48 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Send "ATE0" to the modem to turn off command echoing.
 
Old 08-03-2015, 11:19 AM   #3
rpbulls
LQ Newbie
 
Registered: Jul 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for the suggestion. I'll try it. However, there's one thing I don't understand. I did hook up to this modem using minicom and sent the same commands. I don't see any command echo'ing there. Do you see a reason why we should expect a difference in behavior when sending these commands through a "c" program?
 
Old 08-04-2015, 05:23 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
What initialization string is minicom sending or are you disabling it with -o?
 
Old 08-04-2015, 05:56 AM   #5
rpbulls
LQ Newbie
 
Registered: Jul 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
I don't believe minicom is sending any init string - nor I am explicitly trying to disable any. That's why I'm kind of perplexed.
 
Old 08-04-2015, 08:06 AM   #6
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
When I run minicom -s it says the init string is:
Quote:
A - Init string ......... ~^M~AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0^M
which turns on echo (E1). Did you change your setup? Have you reset the modem since running minicom?
 
Old 08-04-2015, 09:55 AM   #7
rpbulls
LQ Newbie
 
Registered: Jul 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
I'm unable to see the minicom settings the way you are printing it out. However, browsing through the "screen and keyboard" options, it looks like echoing is turned off in there. I'm guessing that's equivalent to "ATE0" that you are suggesting.
 
Old 08-06-2015, 10:16 PM   #8
rpbulls
LQ Newbie
 
Registered: Jul 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
Sorry about the delay in my reply. I managed to find the init string in minicom and it _does_ show that command echoing was enabled. Disabling it in my c-code (using ATE0) helped resolve the issue. Thanks for the help!
 
  


Reply

Tags
serial port



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
[SOLVED] Reading from a serial port rpbulls Linux - Newbie 1 07-31-2015 09:43 AM
writing to /reading from serial port abd_bela Programming 1 07-26-2012 09:09 AM
Serial port reading jayadhanesh Linux - Newbie 3 05-19-2009 06:54 PM
reading from serial port IC009562 Linux - Software 2 11-08-2007 11:25 PM
Having trouble reading from serial port glo Linux - Newbie 0 02-09-2007 10:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:07 PM.

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
Open Source Consulting | Domain Registration