[SOLVED] Reading from serial port - initial string is what I write to it.
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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?
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.
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.