Subject: [wscons] why does ioctl fail if no mux is attached?
To: <>
From: Roland Dowdeswell <>
List: tech-kern
Date: 05/07/2002 02:29:22
So, when I tried to set my alpha up to be a multi-headed machine
a while ago[1], I noticed that the only major obstacle that I ran
into was the fact that any ioctl(2) to a wsdisplay which does not
have an attached keyboard will fail with ENXIO.  I applied the
following patch to src/sys/dev/wscons/wsdisplay.c and then I was
on my way:

Index: wsdisplay.c
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.62
diff -u -r1.62 wsdisplay.c
--- wsdisplay.c	2002/03/17 19:41:05	1.62
+++ wsdisplay.c	2002/05/03 18:06:26
@@ -932,11 +932,11 @@
 	inp = sc->sc_input;
-	if (inp == NULL)
-		return (ENXIO);
-	error = wsevsrc_display_ioctl(inp, cmd, data, flag, p);
-	if (error != EPASSTHROUGH)
-		return (error);
+	if (inp != NULL) {
+		error = wsevsrc_display_ioctl(inp, cmd, data, flag, p);
+		if (error != EPASSTHROUGH)
+			return (error);
+	}
 #endif /* NWSKBD > 0 */
 	switch (cmd) {

The problem is that only one of the cards actually gets the keyboard
device and it is non-trivial to come up with a kernel config which
actually attaches wsmuxes to the other devices, i.e. you have to
hand craft something.

I am suggesting that we apply this patch to the source tree, but
I would like to solicit comments of anyone who is familiar with
the wscons code about any other potential side effects that this
change might have.

I think that this is not a bad approach, because I do not think
that it makes sense to fail arbitrary ioctl(2)s on a wsdisplay just
because a subsystem that they may not actually use is absent.



[1]	please refer to:

 == Roland Dowdeswell                      http://www.Imrryr.ORG/~elric/  ==
 == The Unofficial NetBSD Web Pages        http://www.Imrryr.ORG/NetBSD/  ==
 == The NetBSD Project                            http://www.NetBSD.ORG/  ==