[comp.unix.questions] HOW DO I UNBLOCK A SERIAL LINE ON SUN3?

charles@sifvx6.sinet.slb.com (10/25/89)

I have a problem on a SUN3/60 OS3.5 serial link from /dev/ttya to a plotter
which uses XON/XOFF for flow control. If someone cycles the plotter power in
mid-plot (eg to unblock the paper feed), the serial line hangs because the SUN
is waiting for XON (^Q) and the plotter is not clever enough to send XON when
power is restored. I use the following script to send files...

	(stty -even;stty -odd;stty -echo;cat $1) > /dev/ttya

where $1 is the file name. If I kill the process, it does not unblock the
serial line. If I do a 

	kill -1 1

it does not clear the buffer. Nothing works except reboot or disconnect
/dev/ttya and reconnect to a terminal and type SPACE,RETURN or ^Q, which
empties the buffer onto the screen. Any ideas on clearing the buffer from the
SUN end or improving the script would be much appreciated.

bill@ibmpcug.co.uk (bill birch) (11/15/89)

In article <21267@adm.BRL.MIL> charles@sifvx6.sinet.slb.com writes:
> I have a problem on a SUN3/60 OS3.5 serial link from /dev/ttya to a plotter
> which uses XON/XOFF for flow control. If someone cycles the plotter power in
> mid-plot (eg to unblock the paper feed), the serial line hangs because the SUN
> is waiting for XON (^Q) and the plotter is not clever enough to send XON when

I have had similar problems in the past, but with the Baud rate. 
The trick is to sleep a process on the device thusly:

	sleep 1000000 >/dev/tyya &

What happens is that when the last process  that was using the device


Hope this helps.