Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!sharkey!bnlux0!scottc From: scottc@bnlux0.bnl.gov (david scott coburn) Newsgroups: comp.unix.i386 Subject: Re: ISC 2.0.2, How to set baud rate on serial ports? Summary: keeping serial port 'active' so baud rate can be set. Message-ID: <2097@bnlux0.bnl.gov> Date: 29 Aug 90 13:20:00 GMT References: <9008280005.aa24338@PARIS.ICS.UCI.EDU> <1990Aug28.145215.29143@wolves.uucp> Organization: Brookhaven National Lab Lines: 42 In article <1990Aug28.145215.29143@wolves.uucp>, ggw@wolves.uucp (Gregory G. Woodbury) writes: > 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. [snip] > 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 [snip] > Gregory G. Woodbury @ The Wolves Den UNIX, Durham NC I have the following file in my /etc/rc.d directory: # fudge to keep printer port open echo starting printer fudge routine while [ "/dev/tty00" ] do sleep 30000 > /dev/tty00 done & stty 9600 < /dev/tty00 This enables us to copy to an epson printer on the port by simply copying to the device /dev/tty00. The loop causes problems if you happen to be writing to the port when the 30000 seconds runs out and there is a brief time that the baud rate goes back to the default (300). I have always felt that there should be a better way... scott coburn brookhaven national laboratory scottc@max.bnl.gov [130.199.128.6] upton, ny, usa Define the Universe. Give three examples.