Subject: Getting active console
To: NetBSD Technical Kernel list <tech-kern@netbsd.org>
From: Julio Merino <jmmv@hispabsd.org>
List: tech-kern
Date: 05/28/2002 20:47:03
--aM3YZ0Iwxop3KEKx
Content-Type: multipart/mixed; boundary="FL5UXtIhxfXey3p5"
Content-Disposition: inline


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

Hi all

Retaking my mouse patch, I think we can avoid the need to include
the WSDISPLAY_STIOF ioctl, which writes a character to the active
console.

With the following patch we can get the active console number (i.e.
the one that goes in ttyE?). This feature is already available
using the usl compat, but with this patch we avoid the need to use
the compatibility stuff. Somebody also wanted this feature for
another purpose, can't remember it now.

I've added the new ioctl to ttyE devices, not ttyEcfg. I think this
is ok, though you decide.

The mouse daemon would do the following to paste text using this
feature:
1. Use WSDISPLAY_GETACTIVENO to get active console number.
2. Open /dev/ttyE?, where ? is the value returned before.
3. Call TIOCSTI on the opened file descriptor.
4. Close the file.

What do you think? I think this is a better approach :p

(The patch only contains this feature, not all mouse support)

Thanks.

--=20
Of course it runs NetBSD - http://www.netbsd.org
HispaBSD member - http://www.hispabsd.org
Julio Merino <jmmv@hispabsd.org>

--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch.diff"
Content-Transfer-Encoding: quoted-printable

Index: wsconsio.h
=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
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.50
diff -u -u -r1.50 wsconsio.h
--- wsconsio.h	2002/04/07 09:25:47	1.50
+++ wsconsio.h	2002/05/28 18:40:14
@@ -375,6 +375,9 @@
 #define	WSDISPLAYIO_GETPARAM	_IOWR('W', 82, struct wsdisplay_param)
 #define	WSDISPLAYIO_SETPARAM	_IOWR('W', 83, struct wsdisplay_param)
=20
+/* Get active console number */
+#define WSDISPLAY_GETACTIVENO	_IOR('W', 84, int)
+
 /* XXX NOT YET DEFINED */
 /* Mapping information retrieval. */
=20
Index: wsdisplay.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
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.63
diff -u -u -r1.63 wsdisplay.c
--- wsdisplay.c	2002/04/07 09:25:47	1.63
+++ wsdisplay.c	2002/05/28 18:40:22
@@ -984,6 +984,10 @@
 				(scr->scr_dconf->wsemulcookie, WSEMUL_SYNCFONT);
 		return (error);
 #undef d
+
+        case WSDISPLAY_GETACTIVENO:
+		*(int *)data =3D wsdisplay_getactivescreen(sc);
+		return (0);
 	}
=20
 	/* check ioctls for display */

--FL5UXtIhxfXey3p5--

--aM3YZ0Iwxop3KEKx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (NetBSD)

iD8DBQE889Cnzz00ZOPKycwRAmTrAKCQ1sifnvJ36eXWlvZVdqRehjYhKgCfdikw
MmqLpCHtnF3OohVhXScZpD0=
=C1Rs
-----END PGP SIGNATURE-----

--aM3YZ0Iwxop3KEKx--