*BSD News Article 9720


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6350 ; Fri, 08 Jan 93 08:05:32 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!agate!doc.ic.ac.uk!uknet!mcsun!fuug!kiae!demos!newsserv
From: ache@astral.msk.su (Andrew A. Chernov, Black Mage)
Newsgroups: comp.unix.bsd
Subject: [386bsd] Fix CARRIER for cgd driver, probably for standard too
Message-ID: <YI-p3KhW50@astral.msk.su>
Date: 10 Jan 93 15:13:02 GMT
Sender: news-service@newcom.kiae.su
Reply-To: ache@astral.msk.su
Organization: Ha-oh-lahm Yetzirah
Lines: 72

This patch fix two problems with carrier control.

1) User can't type anything to modem (can't redial, f.e.)
after dropping carrier in dialout programs (pcomm f.e.)

2) TIOCMGET don't report carrier status, so application
(BinkleyTerm f.e.) can't determine carrier.

I don't have standard driver, but maybe it have this problems too.

*** com.c.cdg.was1	Wed Dec 23 10:11:01 1992
--- com.c	Sun Jan 10 17:48:49 1993
***************
*** 390,396 ****
  	else
  	    tp->t_state &=~ TS_CARR_ON;
  
! /*	com_ports[unit].fake_dcd = callout; XXX? */
  
  /* never do this -- we know (or hope!) we have carrier
   *	if (!(flag & O_NONBLOCK))
--- 390,396 ----
  	else
  	    tp->t_state &=~ TS_CARR_ON;
  
! 	com_ports[unit].fake_dcd = callout;
  
  /* never do this -- we know (or hope!) we have carrier
   *	if (!(flag & O_NONBLOCK))
***************
*** 519,527 ****
  
  	if (stat & MSR_DDCD) {
  		register flag = (stat & MSR_DCD) >> 7; /* 0/1 */
! 		if (!(*linesw[tp->t_line].l_modem)(tp, flag))
  			bic(com+com_mcr, MCR_DTR|MCR_RTS);
  	}
  
  	if (stat & MSR_DCTS && stat & MSR_CTS && tp->t_state & TS_ISOPEN
  	    && tp->t_cflag & CCTS_OFLOW)
--- 519,534 ----
  
  	if (stat & MSR_DDCD) {
  		register flag = (stat & MSR_DCD) >> 7; /* 0/1 */
! 		if (!(*linesw[tp->t_line].l_modem)(tp, flag)) {
! 
! 	/* Restore logical carrier if dialing out or not use real carrier */
! 
! 			if (com_ports[unit].fake_dcd || !com_ports[unit].real_car)
! 				tp->t_state |= TS_CARR_ON;
! 			else
  				bic(com+com_mcr, MCR_DTR|MCR_RTS);
  		}
+ 	}
  
  	if (stat & MSR_DCTS && stat & MSR_CTS && tp->t_state & TS_ISOPEN
  	    && tp->t_cflag & CCTS_OFLOW)
***************
*** 672,677 ****
--- 679,685 ----
  				if (m & MCR_DTR) bits |= TIOCM_DTR;
  				if (m & MCR_RTS) bits |= TIOCM_RTS;
  				m = com_mstat[unit];
+ 				if (m & MSR_DCD) bits |= TIOCM_CD;
  				if (m & MSR_CTS) bits |= TIOCM_CTS;
  				if (m & MSR_DSR) bits |= TIOCM_DSR;
  				if (m & (MSR_RI|MSR_TERI)) bits |= TIOCM_RI;
-- 
In-This-Life:  Andrew A. Chernov    |  "Hay mas dicha, mas contento
Internet:      ache@astral.msk.su   |  "Que adorar una hermosura
Organization:  The RELCOM Corp.,    |  "Brujuleada entre los lejos
               Moscow, Russia       |  "De lo imposible?!"  (Calderon)