I am using pySerial for communication with modem.
Does anyone knows which values are for what in these variables?
xonxoff=0
rtscts=0
dsrdtr=0
if xonxoff=0 is it hardware control on or of (logic says it would be off
, but who knows).
Second question is: do I need to send \n or soemthing when I use write().
I would like to do:
ser.write("AT")
print ser.readline()
and get "OK".
Am I doing soemthing wrong?
tnx in advance.
Disclaimer: It's a long time since I bit-bashed a UART ...
Where those relate to bits in the control registers, I'd expect 1 maps
to 1 and 0 maps to 0. Where they relate to functionality provided by
the software, I'd expect 1 to mean "do it" and 0 to mean "don't do
it". Do you have any reason for assuming otherwise?
>
> Second question is: do I need to send \n or soemthing when I use write().
That depends on what the modem is expecting.
>
> I would like to do:
>
> ser.write("AT")
> print ser.readline()
>
> and get "OK".
And what did you get"?
>
> Am I doing soemthing wrong?
Probably what you are doing wrong is not reading the docs.
http://pyserial.sourceforge.net/
"""Be carefully when using "readline". Do specify a timeout when
opening the serial port otherwise it could block forever if no newline
character is received. Also note that "readlines" only works with a
timeout. "readlines" depends on having a timeout and interprets that
as EOF (end of file). It raises an exception if the port is not opened
correctly.
"""
When you have a problem, show all the code (including the opening and
configuring of the port) and tell us what did happen with that code.
The problem was that returning bytes were on few lines and I
didn't look after first \n :(
tnx.
Just a note:
Most modems expect CR (\r), rather than \n.