LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-02-2012, 11:00 AM   #1
alex170872
LQ Newbie
 
Registered: Oct 2008
Posts: 18

Rep: Reputation: 0
Question Serial device (modem) response issues under Linux and python/C++


Hi,

I have some problems I am not able to solve and request some help from the community. I am not even sure this is the right forum, as it encompasses the themes about serial devices, python, C++, boost, dev/tty and modems. If this question better fits to a different forum, please suggest so (and the exact place of this forum).

Here is the problem: I am trying to communicate with a serial modem under Linux (ubuntu 12.04) which is connected to the USB port. The device name is /dev/ttyACM0 and the communication works fine with python and pyserial. That is, when I send the string "AT\r" I will get back an "OK" from the modem.

I have been trying to implement the same functionality using the asio library from boost, see the example code here. I have been trying this code again and again and again on the same port as for the python code, to send the "AT\r" and wait for the "OK" response. It never works, except for the "AT\r" I do not get back anything else from the /dev device. But the python code tells me that in principle this is working.

Basically, I do not know if this problem is related to C++, to boost, to the modem, or to something else. I therefore would appreciate any help regarding talking to a modem especially under C++. Or which forum to post this question. Or what I can try.


Thanks a lot,

Alex
 
Old 10-04-2012, 01:43 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Moved: This thread is more suitable in Programming and has been moved accordingly to help your question get the exposure it deserves.
 
Old 10-04-2012, 11:08 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
The problem with packages like boost is that the idea of insulating the programmer from details and complexity also isolates the programmer from those same details. In Linux, there is a mature existing API called termios. It is widely used and well documented. I suggest familiarizing yourself with it, and after having done so, you may be able to identify the incompatibility. I suggest that you focus on either or both of timeouts and end-of-line usage in Linux. My guess is that the library you are using has some built-in expectations about how your serial port is configured, and may require additional configuration to work around this.

Some online sites that have some serial communications details:
Serial-Howto
Serial Programming Howto
Serial Programming Guide for POSIX OS's

--- rod.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Writing/reading to a modem via serial device? R00ts Programming 3 01-06-2011 06:02 PM
device driver (serial , modem, lpt...) API document where to find ? Muttusagara Linux - Newbie 1 10-05-2007 04:51 PM
Ubuntu Serial Modem Issues christgg Linux - Hardware 3 07-03-2006 02:30 PM
reading and writing to a serial device (modem) Xanadu Linux - Laptop and Netbook 0 01-04-2005 11:05 AM
Windows 2k serial modem issues... Thymox General 3 11-05-2003 06:51 PM


All times are GMT -5. The time now is 06:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration