From: chris@suite.sw.oz.au (Chris Maltby)
Newsgroups: comp.sys.mips
Subject: Re: uugetty problems under RISC/OS
Keywords: uugetty cu modem terminal
Date: 8 Apr 92 03:22:06 GMT
Organization: Softway Pty Ltd

In <1992Mar29.012404.26804@arraytech.com> milton@arraytech.com (Milton Scritsmier) writes:

>In article <2g-j3hkadam@netcom.com> adam@netcom.com (Adam T. Dingle) writes:
>>As modem control seems to be extremely poorly documented, I do not know
>>the circumstances under which an open call to a terminal line will
>>block, which appears to be what is happening in at least the first case.
>>
>>Has anyone encountered similar problems?  Any assistance would be
>>greatly appreciated.  Thanks!
>
>I am seeing very similar problems with the M/120 MIPS machines. I have
>noticed that our uugetty does not seem to respect lock files. For example,
[rest deleted]

Seeing as there are two of you who have asked, here is a repost of my
patch to the generic serial driver (ss.c) (and the motherboard usart
driver scc.c) which fixed our problems with modem control on a 4.52 3230.
The fixes are to eliminate race conditions which either lock the port
or cause dubious opens to succeed (eg uugetty). Your modem must be connected
via a sensible cable which supports RTS, CTS, DSR, DCD and DTR. The modem
itself should be configured to assert DCD only when on-line.
Pass the stuff below through patch.

-----------cut-----------cut-----------cut-----------cut-----------
*** scc.c.orig	Thu Jan 31 13:05:36 1991
--- scc.c	Tue Feb 18 16:06:57 1992
***************
*** 255,260 ****
--- 255,266 ----
  	register struct scc_regs *rp = dp->dp_sccregs;
  	register char	rvl;
  
+ 	/*
+ 	 * No more interrupts expected so can't be BUSY
+ 	 * Softway Pty Ltd, 18/2/92 - PMA, AWM, CHM
+ 	 */
+ 	dpl->ss_state &= ~(SS_BUSY|SS_XBUSY);
+ 
  	rvl = rp->scc_reg[SCCW_ENAB_R] &= ~SCCW_ENAB_TxIntr;
  	scc_put_reg(scp, SCCW_ENAB_R, rvl);
  }
*** ss.c.orig	Mon Feb 10 11:52:44 1992
--- ss.c	Tue Feb 18 10:58:41 1992
***************
*** 365,373 ****
  		ssl->ss_state |= SS_BREAK_QUIET;
  		ssl->ss_tid = timeout(ss_delay, (caddr_t)ssl, HZ/20);
  	} 
! 	if (ssl->ss_state & SS_OPENWAIT) {
  		if (! ssl->ss_rq ||
! 		    (ssl->ss_modem_state & BSD43_TIOCM_CD &&
  		     ss_set_str_control(ssl->ss_rq,SO_OPENWAIT,0)))
  			ssl->ss_state &= ~SS_OPENWAIT;
  		else if (! (ssl->ss_state & SS_TIMEOUT)) {
--- 365,381 ----
  		ssl->ss_state |= SS_BREAK_QUIET;
  		ssl->ss_tid = timeout(ss_delay, (caddr_t)ssl, HZ/20);
  	} 
! 	/*
! 	 * Re-ordered test sequence below - closing overrides openwait!
! 	 * Softway 11/2/92 - AWM, PMA, CHM
! 	 */
! 	if (ssl->ss_state & SS_CLOSING) {	
! 		ssl->ss_state &= ~SS_TIMEOUT;
! 		wakeup((caddr_t)ssl);
! 	}				
! 	else if (ssl->ss_state & SS_OPENWAIT) {
  		if (! ssl->ss_rq ||
! 		    ((ssl->ss_modem_state & BSD43_TIOCM_CD) &&
  		     ss_set_str_control(ssl->ss_rq,SO_OPENWAIT,0)))
  			ssl->ss_state &= ~SS_OPENWAIT;
  		else if (! (ssl->ss_state & SS_TIMEOUT)) {
***************
*** 375,384 ****
  			ssl->ss_tid = timeout(ss_delay, (caddr_t)ssl, HZ/4);
  		};
  	}
- 	else if (ssl->ss_state & SS_CLOSING) {	
- 		ssl->ss_state &= ~SS_TIMEOUT;
- 		wakeup((caddr_t)ssl);
- 	}				
  	splx(s);
  }
  
--- 383,388 ----
***************
*** 1556,1563 ****
  		ss_set_modem(ssl, 0, BSD43_TIOCM_DTR);
  
  
! 		/* wait for modem to drop line */
! 		if (wait_drop_dcd) {
  			ssl->ss_state |= (SS_CLOSING | SS_TIMEOUT);
  			ssl->ss_tid = timeout(ss_delay, (caddr_t)ssl, HZ/ 5);
  			while (ssl->ss_state & SS_TIMEOUT) {
--- 1560,1571 ----
  		ss_set_modem(ssl, 0, BSD43_TIOCM_DTR);
  
  
! 		/* wait for modem to drop line,
! 		 * but only if Carrier is set! - Softway Pty Ltd,
! 		 * 10/2/1992 - AWM, PMA, CHM.
! 		 */
! 		if (wait_drop_dcd && (ssl->ss_modem_state & BSD43_TIOCM_CD))
! 		{
  			ssl->ss_state |= (SS_CLOSING | SS_TIMEOUT);
  			ssl->ss_tid = timeout(ss_delay, (caddr_t)ssl, HZ/ 5);
  			while (ssl->ss_state & SS_TIMEOUT) {
-----------cut-----------cut-----------cut-----------cut-----------
Enjoy.

Ob thanks to MIPS for providing driver sources to patch...
-- 
Chris Maltby - Softway Pty Ltd	(chris@softway.sw.oz.au)

PHONE:	+61-2-698-2322		UUCP:		uunet!softway.sw.oz.au!chris
FAX:	+61-2-699-9174		INTERNET:	chris@softway.sw.oz.au
Newsgroups: comp.sys.mips