Has anyone here used stty to set the baud rate of a serial port in
a script or just from the command line ? I am trying to use "screen
<ser port path>" which gives you a serial (VT100) terminal through the
selected port. In my case I am using USB serial ports and the screen
command works just fine but only at 9,600 baud, the default rate. I
have tried running "stty -f <port path> speed 38400" and "stty speed
38400 < <port path>" before the screen command and this has not changed
the port baud rate. (I've also tried these commands using sudo with no
difference.)
I have looked at the source of stty and see it uses the standard
option and speed setting commands in the POSIX/BSD api. I know these
work since I use them in my serial I/O code I use in other programs
which use these same serial ports and set them to user selected baud
rates and serial parameters. (Also when I do this my programs run as
normal users not Admin so anyone should be able to set/change serial
parameters.)
I seem to be missing something like some other process owns the port
and while stty changes the settings, as soon as it quits they get reset
back to defaults or something. To test this I wrote a command line
program that used my serial port setting code, opened the port
non-exclusively, set the baud rate to 38,400 then before closing the
serial port called system() and ran the screen program. Even there the
screen program still ran at 9,600 baud.
Any suggestions would be welcome.
I'm asking in this group because the "screen port" thing is probably
useful to a lot of programmer types.
--jim