Serial device (modem) response issues under Linux and python/C++
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,
Moved: This thread is more suitable in Programming and has been moved accordingly to help your question get the exposure it deserves.
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 Programming Howto
Serial Programming Guide for POSIX OS's
|All times are GMT -5. The time now is 01:52 PM.|