ISC 2.0.2, How to set baud rate on serial ports?
Gregory G. Woodbury
ggw at wolves.uucp
Wed Aug 29 00:52:15 AEST 1990
In <9008280005.aa24338 at PARIS.ICS.UCI.EDU>
baxter at zola.ICS.UCI.EDU (Ira Baxter) writes:
>
>Trying "stty 9600 < /dev/tty02 & stty -a /dev/tty02" also tells
>me the baud rate is 300, but "stty 9600 < /dev/tty02 & cat FILENAME /dev/tty02"
>moves FILENAME to the Z80 at 9600 baud.
>Par for the course is that "stty 9600 < /dev/tty02 & cat /dev/tty02"
>seems to pick up garbage when the Z80 transmits at 9600;
>I'm guessing, but I highly suspect the "cat" is reading at 300 baud.
>TFM says that stty sets the line characteristics, but it doesn't say
>how long they stay set; it implies that after *every* open, the baud rate
>is set to 300 baud. This is confusing, to say the least.
The key is that the stty command opens the post, sets it, then closes
the port (automagically) which resets it to defaults. The "Fine Manual"
actuall has the answer embedded in discussions about the Line Printer
Spooler where it talks about keeping the port characteristics active
while the rest of the shell scripts do their magic.
The answer is to have a command like:
sleep 10000 >/dev/tty02 &
preceed your
stty 9600 </dev/tty02 >/dev/tty02
cat /dev/tty02 >file
commands. The sleep keeps the port open but inactive. For technical
completeness you should probably get the pid of the sleep command from
the variable "$!" and kill the sleep process after your transfer is
done.
--
Gregory G. Woodbury @ The Wolves Den UNIX, Durham NC
UUCP: ...dukcds!wolves!ggw ...mcnc!wolves!ggw [use the maps!]
Domain: ggw at cds.duke.edu ggw%wolves at mcnc.mcnc.org
[The line eater is a boojum snark! ] <standard disclaimers apply>
More information about the Comp.unix.i386
mailing list