ok, lock is something you wrote yourself ? i can't find it in the docs. However, i think i can essentially build the same thing. the serial module i use is pyserial. pyserial.sourceforge.net. the docs are a wee bit on the sparce side. But i think i can pull it off. Thanks for your help.
shawn On Tue, 2005-11-15 at 10:58 +1300, Hans Dushanthakumar wrote: > I believe that the drivers take care of that, however, I did use locks to > make sure that there were no conflicts. > > In the listener thread I had something along the lines of: > > Acquire lock > readline() from the ser port > Release lock > > And in the sender thread, > > Acquire lock > send msg over ser port > Release lock > > Cheers > Hans > > -----Original Message----- > From: nephish [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 15 November 2005 10:47 a.m. > To: Hans Dushanthakumar > Cc: Hugo González Monteverde; tutor > Subject: RE: [Tutor] question about serial coms > > well thats encouraging, did you have to do anything special to prevent an > error when trying to read or write at the same time ? > > thanks > sk > > > On Tue, 2005-11-15 at 09:29 +1300, Hans Dushanthakumar wrote: > > Ive worked on a similar application. I used one thread to read from the > > serial port and another one to handle the writes. > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > > Behalf Of Hugo González Monteverde > > Sent: Tuesday, 15 November 2005 7:36 a.m. > > To: nephish > > Cc: tutor > > Subject: Re: [Tutor] question about serial coms > > > > Hi Nephish, > > > > Are you using pyserial or rolling your own? Normally you can write and read > > to the /dev/ttySXX file at the same time; since they're special files, not > > ordinary files, the driver handles that. > > > > Handling both writing and reading in your program's flow control is a > > wholly different matter, though. You might need to use select() to avoid > > blocking. > > > > Are you using two completely different scripts for reding and writing? > > > > There is some valuable info, if not about python, in the Serial Programming > > howto, at: > > > > http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/ > > > > > > Hugo > > > > nephish wrote: > > > Hey there, > > > i am developing on a linux computer with the serial module. Now, i > > > already am able to recieve info from a serial RS232 device and > > > process everything ok. What i need to do now is write to the serial > > > device, but i also need to be able to not interrupt the script that > > > is reading from it. > > > I guess my question is, do i have to interrupt the reading script > > > to write to the same RS232 device ? > > > and if so, how do i do that? > > > > > > thanks, > > > shawn > > > > > > _______________________________________________ > > > Tutor maillist - Tutor@python.org > > > http://mail.python.org/mailman/listinfo/tutor > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor