Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Sep 2010 17:06:28 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r212860 - head/sys/kern
Message-ID:  <20100919150628.GN56986@hoeg.nl>
In-Reply-To: <20100919143047.GB2389@deviant.kiev.zoral.com.ua>
References:  <201009191421.o8JELdNY004586@svn.freebsd.org> <20100919143047.GB2389@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--HPvEMLO7QB7Fh5r+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Kostik Belousov <kostikbel@gmail.com> wrote:
> Shouldn't you always report CLOCAL for console then ?

Hmmm... That would be a lot more elegant, also for callout devices. The
change I just committed, doesn't take a loss of SER_DCD into account
after opening the device.

Any comments on the following patch?

%%%
Index: sys/kern/tty.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/kern/tty.c	(revision 212860)
+++ sys/kern/tty.c	(working copy)
@@ -263,12 +263,14 @@
=20
 	if (!tty_opened(tp)) {
 		/* Set proper termios flags. */
-		if (TTY_CALLOUT(tp, dev)) {
+		if (TTY_CALLOUT(tp, dev))
 			tp->t_termios =3D tp->t_termios_init_out;
-		} else {
+		else
 			tp->t_termios =3D tp->t_termios_init_in;
-		}
 		ttydevsw_param(tp, &tp->t_termios);
+		/* Prevent modem control on callout devices and /dev/console. */
+		if (TTY_CALLOUT(tp, dev) || dev =3D=3D dev_console)
+			tp->t_termios.c_cflag |=3D CLOCAL;
=20
 		ttydevsw_modem(tp, SER_DTR|SER_RTS, 0);
=20
@@ -281,9 +283,8 @@
 	}
=20
 	/* Wait for Carrier Detect. */
-	if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) =3D=3D 0 &&
-	    (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0 &&
-	    dev !=3D dev_console) {
+	if ((oflags & O_NONBLOCK) =3D=3D 0 &&
+	    (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0) {
 		while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) =3D=3D 0) {
 			error =3D tty_wait(tp, &tp->t_dcdwait);
 			if (error !=3D 0)
%%%

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--HPvEMLO7QB7Fh5r+
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iEYEARECAAYFAkyWJvQACgkQ52SDGA2eCwVNxgCeOOk0PdC1GeNPwxLCmNsaXJoc
4ngAnijmnHSg0Aj3Yrvhi+BdkAVgffRq
=hMVG
-----END PGP SIGNATURE-----

--HPvEMLO7QB7Fh5r+--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100919150628.GN56986>