Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!sdd.hp.com!uakari.primate.wisc.edu!uflorida!mephisto!mcnc!wolves!ggw From: ggw@wolves.uucp (Gregory G. Woodbury) Newsgroups: comp.unix.i386 Subject: Re: ISC 2.0.2, How to set baud rate on serial ports? Message-ID: <1990Aug28.145215.29143@wolves.uucp> Date: 28 Aug 90 14:52:15 GMT References: <9008280005.aa24338@PARIS.ICS.UCI.EDU> Organization: Wolves Den UNIX and Usenet node Lines: 33 X-Checksum-Snefru: 866851db bbb67d75 6a855456 c3ac43c8 In <9008280005.aa24338@PARIS.ICS.UCI.EDU> baxter@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 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@cds.duke.edu ggw%wolves@mcnc.mcnc.org [The line eater is a boojum snark! ]