Subject: TIOCSBRK/TIOCCBRK revisited..
To: None <port-sparc@sun-lamp.cs.berkeley.edu>
From: matthew green <mrg@oink.home>
List: port-sparc
Date: 05/14/1994 16:25:07
ok, here's the patch with zsclose() handled as well..
i'm running with this patch in now, and it seems to
be fine..


*** zs.c.orig	Thu Mar 24 20:57:07 1994
--- zs.c	Sat May 14 16:07:48 1994
***************
*** 583,588 ****
--- 583,596 ----
  		/* hold low for 1 second */
  		(void) tsleep((caddr_t)cs, TTIPRI, ttclos, hz);
  	}
+ 	if (cs->cs_creg[5] & ZSWR5_BREAK)
+ 	{
+ 		s = splzs();
+ 		cs->cs_preg[5] &= ~ZSWR5_BREAK;
+ 		cs->cs_creg[5] &= ~ZSWR5_BREAK;
+ 		ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
+ 		splx(s);
+ 	}
  	ttyclose(tp);
  #ifdef KGDB
  	/* Reset the speed if we're doing kgdb on this port */
***************
*** 961,967 ****
  	int unit = minor(dev);
  	struct zsinfo *zi = zscd.cd_devs[unit >> 1];
  	register struct tty *tp = zi->zi_cs[unit & 1].cs_ttyp;
! 	register int error;
  
  	error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, p);
  	if (error >= 0)
--- 969,976 ----
  	int unit = minor(dev);
  	struct zsinfo *zi = zscd.cd_devs[unit >> 1];
  	register struct tty *tp = zi->zi_cs[unit & 1].cs_ttyp;
! 	register int error, s;
! 	register struct zs_chanstate *cs = &zi->zi_cs[unit & 1];
  
  	error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, p);
  	if (error >= 0)
***************
*** 973,981 ****
  	switch (cmd) {
  
  	case TIOCSBRK:
! 		/* FINISH ME ... need implicit TIOCCBRK in zsclose as well */
  
  	case TIOCCBRK:
  
  	case TIOCSDTR:
  
--- 982,1005 ----
  	switch (cmd) {
  
  	case TIOCSBRK:
! 		{
! 			s = splzs();
! 			cs->cs_preg[5] |= ZSWR5_BREAK;
! 			cs->cs_creg[5] |= ZSWR5_BREAK;
! 			ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
! 			splx(s);
! 			break;
! 		}
  
  	case TIOCCBRK:
+ 		{
+ 			s = splzs();
+ 			cs->cs_preg[5] &= ~ZSWR5_BREAK;
+ 			cs->cs_creg[5] &= ~ZSWR5_BREAK;
+ 			ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
+ 			splx(s);
+ 			break;
+ 		}
  
  	case TIOCSDTR:
  

------------------------------------------------------------------------------