Setting Port Speed in Linux Python: HOW?

Darren Enns dmenns at home.com
Fri Jun 9 19:32:52 EDT 2000


I checked Deja.com for answers to this question, and didn't find a
clear/short answer, so I will ask it myself:

What simple (Linux) Python code can be used to set the baud rate
of a serial port?

Here is the start of a short Python program that I have that works
just fine, and uses the 'cheater' method to set the baud rate of
the /dev/ttyS0 port:

#!/usr/bin/python
import sys
import os
import string
os.system("stty 4800 raw -F /dev/ttyS0")
udl = open('/dev/ttyS0','r')
...

I want to replace this with a method that does not rely on 'stty'
(since the version of 'stty' on my other Linux machine doesn't
seem to support the '-F' option).

Thanks

Dare

--
Darren Enns
EMAIL: dmenns at home.com
HTTP:  members.home.net/dmenns






More information about the Python-list mailing list