[Ilugc] Serial Communication - Mark/Space parity problem

  • From: steve@xxxxxxxxxxxx (steve)
  • Date: Wed Feb 10 12:04:46 2010

On 02/09/2010 04:35 AM, M.Ganesh wrote:

Hi All,

I am trying to use python&  pyserial on Ubuntu 9.10 to communicate with
a serial device. I need to be able to set the parity bit Mark/Space for
this particular device. I understand linux/posix compliant OSs don't
natively support this. I googled and found this
[http://www.lothosoft.ch/thomas/libmip/markspaceparity.php] link and
implemented that in my code. With this I am able to send only one byte
with my desired parity and the port somehow goes back to 'No parity'
after one byte.

Umm, a quick glance at that pyserial documentation tells me that the parity 
mode 
setting can be done using the module constants:

http://pyserial.sourceforge.net/pyserial_api.html#constants

is this how you are setting the parity bit ?

I am assuming that pyserial should do the RIGHT THING(tm) irrespective of the 
OS, which might not be true if instead you are twiddling around using the 
termios module (as suggested in the link you posted).

cheers,
- steve

PS: You can also direct your python specific questions to the bangpypers 
mailing 
list where a number of Indian pythoniasts hang out:
http://mail.python.org/mailman/listinfo/bangpypers

-- 
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/

Other related posts: