Subject: bin/23223: [PATCH] wsmoused xconsole bug (and doc bugs!)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <naoki@fukaumi.org>
List: netbsd-bugs
Date: 10/22/2003 15:33:00
>Number:         23223
>Category:       bin
>Synopsis:       [PATCH] wsmoused xconsole bug (and doc bugs!)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 22 06:34:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 1.6ZD
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD tr1.naobsd.org 1.6ZD NetBSD 1.6ZD (TR1) #0: Mon Oct 20 19:17:31 JST 2003 root@tr1.naobsd.org:/usr/obj/i386/sys/arch/i386/compile/TR1 i386
Architecture: i386
Machine: i386
>Description:
	wsmoused(8) xconsole feature is broken.
	If you switch from xconsole to other console, All key stroke will
	be ignored.

	XXX In wsmoused.conf(5) and /usr/share/examples/wsmoused/wsmoused.conf,
	XXX   "xconsole option is for selection mode"
	XXX It's wrong. It's global option. See wsmoused.c.

	XXX Some another options described in wsmoused.conf(5) are misplaced,
	XXX too. Sync document, example and code, please.

>How-To-Repeat:
	Enable xconsole=4 in wsmoused.conf (in global section)
	Start wsmoused
	Switch ttyE4 (Alt + F5)
	Switch ttyE0 (Alt + F1) and wait 5 sec.

	Then, your keyboard (stdin) becomes unusable.
	(See fstat(1) output to see what happens)

>Fix:
	Patch for code and example conf. Please fix man page bugs.

Index: src/share/examples/wsmoused/wsmoused.conf
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/share/examples/wsmoused/wsmoused.conf,v
retrieving revision 1.3
diff -u -r1.3 wsmoused.conf
--- src/share/examples/wsmoused/wsmoused.conf	6 Aug 2003 22:16:34 -0000	1.3
+++ src/share/examples/wsmoused/wsmoused.conf	22 Oct 2003 05:52:16 -0000
@@ -12,15 +12,15 @@
 # List of modes that will be activated at runtime (selection is the default).
 #modes = "selection action";
 
+# The console where the X server runs (usually /dev/ttyE4).
+#xconsole = 4;
+
 # Selection mode (sel) specific configuration.
 mode selection {
 
 #	Tune mouse movement speed.
 #	slowdown_x = 0;
 #	slowdown_y = 3;
-
-#	The console where the X server runs (usually /dev/ttyE4).
-#	xconsole = 4;
 
 }
 
Index: src/usr.sbin/wsmoused/selection.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/usr.sbin/wsmoused/selection.c,v
retrieving revision 1.5
diff -u -r1.5 selection.c
--- src/usr.sbin/wsmoused/selection.c	6 Aug 2003 23:58:40 -0000	1.5
+++ src/usr.sbin/wsmoused/selection.c	22 Oct 2003 05:47:37 -0000
@@ -318,7 +318,8 @@
 			selarea_hide();
 		cursor_hide();
 
-		open_tty(evt.value);
+		if (!Selmouse.sm_mouse->m_disabled)
+			open_tty(evt.value);
 
 		cursor_show();
 		if (Selmouse.sm_selecting)
@@ -377,12 +378,10 @@
 	if (Selmouse.sm_ttyfd >= 0)
 		(void)close(Selmouse.sm_ttyfd);
 
-	if (!Selmouse.sm_mouse->m_disabled) {
-		(void)snprintf(buf, sizeof(buf), _PATH_TTYPREFIX "%d", ttyno);
-		Selmouse.sm_ttyfd = open(buf, O_RDONLY | O_NONBLOCK);
-		if (Selmouse.sm_ttyfd < 0)
-			log_warnx("cannot open %s", buf);
-	}
+	(void)snprintf(buf, sizeof(buf), _PATH_TTYPREFIX "%d", ttyno);
+	Selmouse.sm_ttyfd = open(buf, O_RDONLY | O_NONBLOCK);
+	if (Selmouse.sm_ttyfd < 0)
+		log_warnx("cannot open %s", buf);
 }
 
 /* ---------------------------------------------------------------------- */
>Release-Note:
>Audit-Trail:
>Unformatted: