Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread mlenz
I'm working on a project where I need to communicate with some devices via modem which have the possibility of using MARK and SPACE parity. These are not defined by POSIX and therefore are not directly supported under Linux. I've found the following discussion on the topic:

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
I should also note that I am aware of the following discussion on the newsgroup: https://groups.google.com/d/msg/comp.lang.python/1HyCqPSOf50/eQINFrrFKwoJ However, I believe this refers to implementing the solution for 8M1 and 8S1. -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Nizamov Shawkat
2011/11/21 ml...@nocturnal.org: I'm working on a project where I need to communicate with some devices via modem which have the possibility of using MARK and SPACE parity.  These are not defined by POSIX and therefore are not directly supported under Linux. I've found the following

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Using 8N1 under minicom with this device resulted in garbled text when once connected. Connection using 7M1 resulted in the correct text. So there must be something else that needs to be done in my python program correct? -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Chris Angelico
On Tue, Nov 22, 2011 at 3:28 AM, Matthew Lenz matt...@nocturnal.org wrote: Using 8N1 under minicom with this device resulted in garbled text when once connected.  Connection using 7M1 resulted in the correct text.  So there must be something else that needs to be done in my python program

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread David Riley
On Nov 21, 2011, at 11:28 AM, Matthew Lenz wrote: Using 8N1 under minicom with this device resulted in garbled text when once connected. Connection using 7M1 resulted in the correct text. So there must be something else that needs to be done in my python program correct? Under minicom in

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Ahh. Ok. So how would I go about doing that with python? I think in perl (sorry for the naughty word) I could use the tr// (translate) but is there a quick way to do so with python? Is it going to be necessary to convert commands I SEND to the device or only convert what I receive? --

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread David Riley
On Nov 21, 2011, at 11:52 AM, Matthew Lenz wrote: Ahh. Ok. So how would I go about doing that with python? I think in perl (sorry for the naughty word) I could use the tr// (translate) but is there a quick way to do so with python? Is it going to be necessary to convert commands I SEND

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread gene heskett
On Monday, November 21, 2011 11:58:53 AM David Riley did opine: On Nov 21, 2011, at 11:28 AM, Matthew Lenz wrote: Using 8N1 under minicom with this device resulted in garbled text when once connected. Connection using 7M1 resulted in the correct text. So there must be something else that

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread David Riley
On Nov 21, 2011, at 12:25 PM, gene heskett wrote: And that is 9600 baud 8n1 on both ends. Ascii is normally 7 bit and will have a low 8th bit if fed normal ascii data, so how is the 8th bit getting set other than purposely setting 7M1 on the other end of the cable? That's what I thought

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Thanks, this will be a great help. Just wanted to confirm that you meant to use [ .. for x in ord_str] in the example conversion? Got a TypeError using the received_str. -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread David Riley
On Nov 21, 2011, at 12:59 PM, Matthew Lenz wrote: Thanks, this will be a great help. Just wanted to confirm that you meant to use [ .. for x in ord_str] in the example conversion? Got a TypeError using the received_str. Yes, I probably should have double-checked that. ord_str is indeed

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread MRAB
On 21/11/2011 16:52, Matthew Lenz wrote: Ahh. Ok. So how would I go about doing that with python? I think in perl (sorry for the naughty word) I could use the tr// (translate) but is there a quick way to do so with python? Is it going to be necessary to convert commands I SEND to the device

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread gene heskett
On Monday, November 21, 2011 01:28:16 PM David Riley did opine: On Nov 21, 2011, at 12:25 PM, gene heskett wrote: And that is 9600 baud 8n1 on both ends. Ascii is normally 7 bit and will have a low 8th bit if fed normal ascii data, so how is the 8th bit getting set other than purposely

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Another thing I noticed is that the and | appear to give the same result as adding or subtracting 128 from the ordinal value. I'm assuming that isn't coincidence. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Grant Edwards
On 2011-11-21, Matthew Lenz matt...@nocturnal.org wrote: Another thing I noticed is that the and | appear to give the same result as adding or subtracting 128 from the ordinal value. Nope, that's only true for some values. If we're limiting ourselves to byte values, then we're talking

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread David Riley
On Nov 21, 2011, at 2:29 PM, Matthew Lenz wrote: Another thing I noticed is that the and | appear to give the same result as adding or subtracting 128 from the ordinal value. I'm assuming that isn't coincidence. :) It's not, though the difference is important. They're binary ANDs () and

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Grant Edwards
On 2011-11-21, David Riley fraveyd...@gmail.com wrote: On Nov 21, 2011, at 2:29 PM, Matthew Lenz wrote: Another thing I noticed is that the and | appear to give the same result as adding or subtracting 128 from the ordinal value. I'm assuming that isn't coincidence. :) It's not, though

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Grant Edwards
On 2011-11-21, Grant Edwards invalid@invalid.invalid wrote: Like the old joke: There are 10 kinds of people in the world: those who understand binary numbers, and those who don't. OK, it's not _much_ of a joke, but I don't get to use it very often, so I couldn't let it go (for one thing,

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Chris Angelico
On Tue, Nov 22, 2011 at 10:09 AM, Grant Edwards invalid@invalid.invalid wrote: On 2011-11-21, Grant Edwards invalid@invalid.invalid wrote: Like the old joke:   There are 10 kinds of people in the world: those who understand   binary numbers, and those who don't. OK, it's not _much_ of a