On Mon, Jul 7, 2008 at 4:43 PM, Anthony Roberts <[EMAIL PROTECTED]> wrote: > It looks like I was indeed supposed to use cua, and I can now get a file > descriptor. However, I'm still not able to set the baud rate, it's stuck > at 19200 whether I try to set it with tty01 or cua01. cua00 corresponds > with tty00, which is the serial console, so I shouldn't use that.
I don't recall where this is documented, but terminal devices reset their settings when the last fd open to them is closed. # stty </dev/cua00 19200; stty </dev/cua00 speed 9600 baud; lflags: echoe echoke echoctl cflags: cs8 -parenb # ( stty 19200; stty ) </dev/cua00 speed 19200 baud; lflags: echoe echoke echoctl cflags: cs8 -parenb # If you can't put the termios manipulation in the python script, then you can do the open and stty in a shell script surrounding it. Let's say you need access to the real stdin from your python script. In that case, this snippet of shell would work: #!/bin/sh ( stty 2400 <&3 ; python script-here ) 3<>/dev/cua01 That opens /dev/cua01 for read/write on fd 3, then runs "stty 2400" with fd 3 dup'ed to fd 0 (so the stty sees the cua device), and then runs the python script with the cua device still open on fd 3. How to access fd 3 from the script is up to you... Philip Guenther