Subject: Re: i386 / 7E1 on serial ports
To: Jukka Marin <jmarin@teeri.jmp.fi>
From: Scott Reynolds <scottr@edsi.org>
List: current-users
Date: 09/14/1995 08:03:58
On Thu, 14 Sep 1995, Jukka Marin wrote:

> I have noticed that running certain programs on the i386 port changes the
> serial port settings to 7E1 from 8N1.  The only way to return to 8-bit
> mode is to log out and log back in.  stty command doesn't help.

The problem is related to using the old BSD sgttyb/ioctl() interface to 
change tty parameters.  If you port the software to use termios(4) 
instead, the "problem" will disappear (this is usually pretty trivial, 
given that most software already supports SysV termio).

Having said that, I have something that may help you.  I forget who 
originally posted this, since I have the code under revision control, but 
it's in a PR sent in some time ago.  It doesn't fix all the problems and 
I definitely recommend porting to termios(4) regardless. :-)

*** sys/kern/tty_compat.c	1995/08/13 01:30:48	1.1
--- sys/kern/tty_compat.c	1995/08/13 01:31:11	1.2
***************
*** 268,277 ****
  		} else
  			flags |= EVENP | ODDP;
  	} else {
! 		if ((tp->t_flags & LITOUT) && !(oflag & OPOST))
  			flags |= LITOUT;
! 		if (tp->t_flags & PASS8)
! 			flags |= PASS8;
  	}
  	
  	if ((lflag & ICANON) == 0) {	
--- 268,276 ----
  		} else
  			flags |= EVENP | ODDP;
  	} else {
! 		if (oflag & OPOST)
  			flags |= LITOUT;
! 		flags |= PASS8;
  	}
  	
  	if ((lflag & ICANON) == 0) {