Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-17 Thread Hendrik van Rooyen
On Sunday 16 August 2009 15:55:31 Grant Edwards wrote: > On 2009-08-15, Hendrik van Rooyen wrote: > > I am still confused about pyserial and serial - I found serial > > in my distribution library, (on the SuSe machine, not on the > > 2.5 in Slackware) but I had to download pyserial. > > That's ve

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-16 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen wrote: > On Saturday 15 August 2009 16:25:03 Grant Edwards wrote: > >> Are you using python file operations open/read/write or OS >> file-descriptor operations os.open/os.read/os.write? > > The former - that seems to be the source of my trouble. > > I have now wri

Re: Is it possible to use python to get True Full Duplex on a Serial port? - conclusions

2009-08-16 Thread Hendrik van Rooyen
On Sunday 16 August 2009 08:20:34 John Nagle wrote: > Hendrik van Rooyen wrote: > > On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: > >> Hendrik van Rooyen wrote: > >>> In the past, on this group, I have made statements that said that on > >>> Linux, the serial port handling somehow doe

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread John Nagle
Hendrik van Rooyen wrote: On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: Hendrik van Rooyen wrote: In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody con

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 16:25:03 Grant Edwards wrote: > > Are you using python file operations open/read/write or OS > file-descriptor operations os.open/os.read/os.write? The former - that seems to be the source of my trouble. I have now written a little test that uses serial.Serial and it w

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: > Hendrik van Rooyen wrote: > > In the past, on this group, I have made statements that said that on > > Linux, the serial port handling somehow does not allow transmitting and > > receiving at the same time, and nobody contradicted me. >

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen wrote: > 8< > -PosixSerial.py > > Thanks that looks, on first inspection, similar to the > serialposix.py module in the stdlib, but less cluttered. pyserial is a bit more complex because it is cross-p

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen wrote: > On Friday 14 August 2009 16:03:22 Diez B. Roggisch wrote: > >> You should *really* just use pyserial. No hassle, instant satisfaction. > >:-) I have downloaded and had a quick look, and I see it is > based on the standard library's serial.Serial class - a

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen wrote: > On Friday 14 August 2009 16:19:04 Grant Edwards wrote: > >> What platform are you using? I suppose it's possible that >> there's something broken in the serial driver for that >> particular hardware. > > Your experience seems to be exactly the opposite t

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Michael Ströder
Hendrik van Rooyen wrote: > In the past, on this group, I have made statements that said that on Linux, > the serial port handling somehow does not allow transmitting and receiving at > the same time, and nobody contradicted me. Despite all the good comments here by other skilled people I'd rec

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread greg
Terry Reedy wrote: I believe the C standard specifies that the behavior of mixed reads and writes is undefined without intervening seek and/or flush, even if the seek is ignored (as it is on some Unix systems). With two threads, the timing is undetermined. It's also possible that the stdio o

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 04:03:42 Terry Reedy wrote: > greg wrote: > > You can't read and write with the same stdio file object > > at the same time. Odd things tend to happen if you try. > > I believe the C standard specifies that the behavior of mixed reads and > writes is undefined without int

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:28:26 Grant Edwards wrote: > On 2009-08-14, greg wrote: > > Hendrik van Rooyen wrote: 8<--- > Doh! It didn't even occur to me that somebody would use python > "file" objects for serial ports, and I completely

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:19:36 Grant Edwards wrote: > On 2009-08-14, exar...@twistedmatrix.com wrote: > > One strategy you might employ to get rid of the busy looping > > is to use Twisted and its serial port support. This also > > addresses the full- duplex issue you've raised. > > There are

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:03:22 Diez B. Roggisch wrote: > You should *really* just use pyserial. No hassle, instant satisfaction. :-) I have downloaded and had a quick look, and I see it is based on the standard library's serial.Serial class - another battery that I have not used before. An

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:19:04 Grant Edwards wrote: > On 2009-08-14, Hendrik van Rooyen wrote: > > In the meantime I have had another idea which I have also not tried yet, > > namely to do independent opens for reading and writing, to give me two > > file instances instead of one, and to try wi

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 15:58:37 exar...@twistedmatrix.com wrote: > One strategy you might employ to get rid of the busy looping is to use > Twisted and its serial port support. This also addresses the full- > duplex issue you've raised. I know - vaguely - about twisted and I have been dancing

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Terry Reedy
greg wrote: You can't read and write with the same stdio file object at the same time. Odd things tend to happen if you try. I believe the C standard specifies that the behavior of mixed reads and writes is undefined without intervening seek and/or flush, even if the seek is ignored (as it i

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread exarkun
On 02:19 pm, inva...@invalid wrote: On 2009-08-14, exar...@twistedmatrix.com wrote: One strategy you might employ to get rid of the busy looping is to use Twisted and its serial port support. This also addresses the full- duplex issue you've raised. There are no such full-dulex issues. The

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, greg wrote: > Hendrik van Rooyen wrote: > >> port = open("/dev/ttyS0","r+b",0) >> >> What I would really like is to have two threads - one that >> does blocking input waiting for a character, and one that >> examines an output queue and transmits the stuff it finds. > > You can't r

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, exar...@twistedmatrix.com wrote: > One strategy you might employ to get rid of the busy looping > is to use Twisted and its serial port support. This also > addresses the full- duplex issue you've raised. There are no such full-dulex issues. -- Grant Edwards g

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, Hendrik van Rooyen wrote: > In the meantime I have had another idea which I have also not tried yet, > namely to do independent opens for reading and writing, to give me two file > instances instead of one, and to try with that. I have no idea if it would > make any difference,

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, Hendrik van Rooyen wrote: > In the past, on this group, I have made statements that said > that on Linux, the serial port handling somehow does not allow > transmitting and receiving at the same time, That's not true. Linux/Unix does and always has supported full-duplex communica

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: On Friday 14 August 2009 14:13:46 greg wrote: You can't read and write with the same stdio file object at the same time. Odd things tend to happen if you try. You need to open *two* file objects, one for reading and one for writing: fr = open("/dev/ttyS0","rb",0

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread exarkun
On 01:38 pm, hend...@microcorp.co.za wrote: On Friday 14 August 2009 12:54:32 Diez B. Roggisch wrote: How about using pyserial? With that, I never had any problems accessing the the serial ports, and AFAIK no duplex-problems as well. And I seriously doubt that these are a python-related probl

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Hendrik van Rooyen
On Friday 14 August 2009 14:13:46 greg wrote: > You can't read and write with the same stdio file object > at the same time. Odd things tend to happen if you try. > > You need to open *two* file objects, one for reading > and one for writing: > >fr = open("/dev/ttyS0","rb",0) >fw = open("/

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Hendrik van Rooyen
On Friday 14 August 2009 12:54:32 Diez B. Roggisch wrote: > > How about using pyserial? With that, I never had any problems accessing > the the serial ports, and AFAIK no duplex-problems as well. And I > seriously doubt that these are a python-related problem - python only > has a very thin, direc

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread greg
Hendrik van Rooyen wrote: port = open("/dev/ttyS0","r+b",0) What I would really like is to have two threads - one that does blocking input waiting for a character, and one that examines an output queue and transmits the stuff it finds. You can't read and write with the same stdio file objec

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody contradicted me. I am running into the self same issue again. What I normally do is

Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Hendrik van Rooyen
In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody contradicted me. I am running into the self same issue again. What I normally do is to open the port like this: p