ISC 2.0.2, How to set baud rate on serial ports?

david scott coburn scottc at bnlux0.bnl.gov
Wed Aug 29 23:20:00 AEST 1990


In article <1990Aug28.145215.29143 at wolves.uucp>, ggw at wolves.uucp (Gregory G. Woodbury) writes:
> 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.
 [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 >/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 at max.bnl.gov [130.199.128.6]                          upton, ny, usa
		Define the Universe.  Give three examples.



More information about the Comp.unix.i386 mailing list