Cross-platform serial port access

Grant Edwards grante at
Thu Mar 22 16:27:43 CET 2001

In article <99d274$ogv$1 at>, David Brown wrote:

>I am relatively new to Python, but am planning to use it for a
>number of small programs that should be able to run both on
>Windows (for initial development and testing) and Linux (once
>we get a server running properly). Some of these programs will
>need to communicate with external devices using a serial port -
>is this going to work in a portable fashion using Python?

Currently, serial port stuff in Python is not portable between

>Does anyone know if Linux supports RTS toggle handshaking
>(i.e., the RTS line is high while transmitting, for convenient
>connection to RS-485 convertors),

Not with the standard PC serial port driver.  I hacked the
16x50 driver to do RTS toggle several years ago, but it never
worked reliably.  It's very difficult to do it reliably in
software at high baud rates.

Your best bet is to buy a board that supports RTS toggle in
hardware or use a 232-485 converter that handles it
automatically by detecting the presence of data.  The only
board I've used under Linux that supported hardware RTS toggle
was Cyclades Y series 8-port board.  I believe that RTS toggle
support doesn't work in their newer boards, so you might have
to look around.

>and is it easy to control from Python?  Are there any Python
>modules designed to work with modems?

Grant Edwards                   grante             Yow!  Could I have a drug
                                  at               overdose?

More information about the Python-list mailing list