Subject: Feb12-current: com.c fix
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: current-users
Date: 02/27/1994 13:21:50
The following patch is necessary for programs (such as uugetty) that
wish to reset a modem by toggling DTR off then on.  The -current com.c
(Nov20, and Feb12 at least), turned DTR off when seting speed to 0,
but failed to ensure it was asserted when speed != 0.

Note that I also made it only toggle DTR and RTS off since they were
the only ones that would be turned back on.

With this installed, mgetty now works fine with the standard tty ports
to provide dial in/out on same device.

*** sys/arch/i386/isa/com.c~	Thu Feb 10 22:13:38 1994
--- sys/arch/i386/isa/com.c	Sun Feb 27 13:00:08 1994
***************
*** 483,490 ****
  	com = com_addr[unit];
  	outb(com+com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS /*| IER_EMSC*/);
  	if (ospeed == 0) {
! 		(void) commctl(unit, 0, DMSET);	/* hang up line */
  		return(0);
  	}
  	outb(com+com_cfcr, inb(com+com_cfcr) | CFCR_DLAB);
  	outb(com+com_data, ospeed & 0xFF);
--- 483,495 ----
  	com = com_addr[unit];
  	outb(com+com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS /*| IER_EMSC*/);
  	if (ospeed == 0) {
! 		(void) commctl(unit, MCR_DTR|MCR_RTS, DMBIC); /* hang up line */
  		return(0);
+ 	} else {
+ 		/*
+ 		 * <sjg> need to [re]assert DTR
+ 		 */
+ 		(void) commctl(unit, MCR_DTR|MCR_RTS, DMBIS);
  	}
  	outb(com+com_cfcr, inb(com+com_cfcr) | CFCR_DLAB);
  	outb(com+com_data, ospeed & 0xFF);

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