Serial Port
David Brown
david at no.westcontrol.spam.com
Mon Nov 18 14:57:50 EST 2002
"Grant Edwards" <grante at visi.com> wrote in message
news:3dd90d82$0$22206$a1866201 at newsreader.visi.com...
> In article <arahhn$urd$1 at news.netpower.no>, David Brown wrote:
> > "Grant Edwards" <grante at visi.com> wrote in message
> >
> >> On a slight tangent, anybody know where there's documentation
> >> or examples of doing stuff like overlapped serial I/O under
> >> Win32 with events and callbacks and suchlike in Python? I
> >> haven't found a copy of the Python on Win32 book yet...
> >
> > I find it easier to run serial communication in a seperate
> > thread if I need asynchronous communication.
>
> Yes, it's far easier to use a thread per port.
>
> But my task is to try to troubleshoot serial driver bugs
> triggered by certain sequences of Win32 system calls. My
> customers are dyed-in-the-wool Win32 hacks who do things the
> most obtuse, complex way possible. They love callbacks and I/O
> completion ports and all that cruft. When they do stuff like
> that and report problems, my requirement isn't to write a
> program that performs serial I/O, it's to do it in a certain
> way in order to reproduce problems reported by customers.
>
I have had the same sort of situation - everything works fine for my test
code, nothing works for the customer. I can't help here - only sympathise.
> > You don't normally have so many serial ports open at a time
> > that the threading overhead is significant,
>
> I don't? I usually limit my test cases to 32 ports if
> possible, but on occasion have to use 100+ ports.
>
Ok, correction - *I* don't normally have that many ports open at a time. I
thought I was unusual in having 6 serial ports on my PC... Out of
curiosity, what is the application?
> > it is much easier than messing with the overlapped I/O stuff,
> > and it is platform-independant.
>
> Oh, I know it's easier doing sych I/O, and I don't care about
> platform independance. I've never been asked to troubleshoot a
> Win32 driver under Linux. :)
>
> > To be entirely honest, though, the couple of Python programs I
> > have written so far that use the serial port have not bothered
> > with threading either - they just send out something, and wait
> > for a reply or timeout (using the inWaiting() function from
> > pyserial, along with time.sleep). But if I needed something
> > more advanced, then I *would* use threads - I've done it in
> > Delphi, and it works fine.
>
> I use threads a lot for serial communications too. Sometimes
> one-thread-per-port isn't what is required.
>
I sounds like I've been trying to help with the wrong problem, and I don't
think I can be of much help to the real problem. Good luck!
More information about the Python-list
mailing list