LMDMBUF and LNOHANG with dz

utzoo!decvax!harpo!zeppo!wheps!eagle!mhuxt!cbosg!cincy!jreuter utzoo!decvax!harpo!zeppo!wheps!eagle!mhuxt!cbosg!cincy!jreuter
Mon May 3 08:28:35 AEST 1982


The dz and dh drivers for 2.8BSD don't support the LMDMBUF and LNOHANG
options that will allow a device to use carrier-detect to handshake.
I had to do this for an Epson MX-100 with a 2k buffer serial option (I
understand they now have a 2k buffer serial option that does XON and XOFF
so get that if you're buying Epsons...) so here is the diff with the fixed.

This still didn't quite cut it on an 11/23 because the callouts didn't
always get processed fast enough to detect the change in CD before the buffer
filled.  I plan to call dzscan from dzxint every 16 interrupts or so, but
that's a kluge so I'm not publishing it.

diff dz.c dz.c.old
28d27
< int	dzsoftCAR[NDZ11];
113d111
< 	dzsoftCAR[dev] = 0;
182c180
< 	if ( (tp->t_flags&RAW) || (tp->t_flags&LLITOUT) )
---
> 	if (tp->t_flags&RAW)
286c284
< 	if (flag == OFF) {
---
> 	if (flag==OFF)
288,290c286
< 	} else {
< 		dzaddr->dzdtr |= bit;
< 	}
---
> 	else	dzaddr->dzdtr |= bit;
305,314c301,303
< 			if (dzsoftCAR[i] == 0) {
< 				if ( (tp->t_state&WOPEN)==0 &&
< 				    (tp->t_local&LMDMBUF) ) {
< 					tp->t_state &= ~TTSTOP;
< 					ttstart(tp);
< 				} else {
< 					wakeup( (caddr_t)&tp->t_rawq );
< 					tp->t_state |= CARR_ON;
< 				}
< 				dzsoftCAR[i] = 1;
---
> 			if ((tp->t_state&CARR_ON)==0) {
> 				wakeup((caddr_t)&tp->t_rawq);
> 				tp->t_state |= CARR_ON;
317,323c306,309
< 			if (dzsoftCAR[i] == 1) {
< 				if ( (tp->t_state&WOPEN)==0 &&
< 				    (tp->t_local&LMDMBUF) )
< 					tp->t_state |= TTSTOP;
< 				else if ( (tp->t_state&WOPEN)==0 &&
< 				    (tp->t_local&LNOHANG)==0 ) {
< 					signal( tp->t_pgrp, SIGHUP );
---
> 			if ((tp->t_state&CARR_ON) &&
> 			    (tp->t_local&LNOHANG)==0) {
> 				if (tp->t_state&ISOPEN) {
> 					signal(tp->t_pgrp, SIGHUP);
325,328c311,313
< 					flushtty( tp, FREAD|FWRITE );
< 				} else
< 					tp->t_state &= ~CARR_ON;
< 				dzsoftCAR[i] = 0;
---
> 					flushtty(tp, FREAD|FWRITE);
> 				}
> 				tp->t_state &= ~CARR_ON;
332c317
< 	timeout(dzscan, (caddr_t)0, 4);
---
> 	timeout(dzscan, (caddr_t)0, 120);

	Jim Reuter



More information about the Comp.bugs.2bsd mailing list