values of sys.platform? for a serial port lib

Chris Liechti cliechti at gmx.net
Sun Dec 30 07:33:22 EST 2001


Peter Hansen <peter at engcorp.com> wrote in
news:3C2E82A5.D4E1EEB3 at engcorp.com: 
> Chris Liechti wrote:
>> i also have an optional argument to specify the port string, but when
>> this is used it isn't portable anymore. 
> 
> Just a thought, but could you make this the same argument as 
> the port number, allowing either an integer or a string?  
> I could also see a benefit, in a cross-platform serial-port app, 
> in having a method to return the actual device name in use, for 
> display/troubleshooting purposes, even if specified as a number.

minutes after i wrote the that message, i changed the code so that it is 
the same argument that takes a number or a string.

i'll add a method to return the device name.

> You may know this already, but in Windows you need to use 
> "overlapped" I/O operations if you want to be able to have
> a read thread and a write thread waiting independently on 
> operations on the same serial port.  Without this, any time 
> one thread is blocked waiting for results for its operation, 
> the other thread will also block when it tries to access the 
> device even if its operation would not otherwise block.  
> (Or something like that... I don't know the full details 
> behind it, only what I learned trying to implement a win32file-
> based serial port class which didn't have this limitation.)
 
it uses overlapped io. it's roughly based on the serial example that comes 
with the win32all package.

chris


-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list