values of sys.platform? for a serial port lib

Peter Hansen peter at engcorp.com
Sat Dec 29 18:39:41 EST 2001


Chris Liechti wrote:
> 
> i've written a portable serial port library. it runs now on linux and win32
> (using marks win32all) but i would like to make it compatible with more
> unix like platforms. basicaly it should run on any POSIX compilant system.
> 
> i'm interested in values for "sys.platform" and, if possible, the name of
> the serial port (an how the ports are numbered ttyS0, ttyS1 etc.)
> e.g "linux2" and "/dev/ttyS%d" % port, numbering starting at zero.

Between links on Unix, third-party serial port devices under
Windows which might not use the COMx convention, and other such
variations, I'd strongly recommend you *not* try to use an
index origin of 0 but instead pass the open() routine (or
whatever you have) a *string* naming the serial port.

By the way, does your win32 implementation work well with
threads, if one thread is trying to read from the port while
the other is trying to write to it?

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list