summaryrefslogtreecommitdiff
path: root/sys/dev/wscons/wsdisplay.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-08-05 16:59:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-08-05 16:59:58 +0000
commit3506198ba75b83f8209a3f603e787a17a8a72394 (patch)
tree95842fd2245280a57dca6252bd0d93f4448e0d2c /sys/dev/wscons/wsdisplay.c
parentabf0e33e77db61eb3b704c1dddd10ac7bc15a477 (diff)
On platforms which do not use wsmux (because they can't have more than one
keyboard at once), force wskbd0 to connect to wsdisplay0 even if they are not console devices.
Diffstat (limited to 'sys/dev/wscons/wsdisplay.c')
-rw-r--r--sys/dev/wscons/wsdisplay.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 1d7ae0f915b..7c2cdb9d757 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.68 2006/07/11 05:57:20 miod Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.69 2006/08/05 16:59:57 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -628,8 +628,6 @@ wsdisplay_common_detach(struct wsdisplay_softc *sc, int flags)
* there, but there is currently no support for this in wsmux.
*/
#else
- extern int wskbd_set_display(struct device *, struct wsevsrc *);
-
if ((rc = wskbd_set_display((struct device *)sc->sc_input,
NULL)) != 0)
return (rc);
@@ -751,6 +749,23 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
if (hookset == 0)
shutdownhook_establish(wsdisplay_shutdownhook, NULL);
hookset = 1;
+
+#if NWSKBD > 0 && NWSMUX == 0
+ if (console == 0) {
+ /*
+ * In the non-wsmux world, always connect wskbd0 and wsdisplay0
+ * together.
+ */
+ extern struct cfdriver wskbd_cd;
+
+ if (wskbd_cd.cd_ndevs != 0 && sc->sc_dv.dv_unit == 0) {
+ if (wsdisplay_set_kbd(&sc->sc_dv,
+ (struct wsevsrc *)wskbd_cd.cd_devs[0]) == 0)
+ wskbd_set_display(wskbd_cd.cd_devs[0],
+ &sc->sc_dv);
+ }
+ }
+#endif
}
void
@@ -1997,6 +2012,22 @@ wsdisplay_set_console_kbd(struct wsevsrc *src)
#endif
src->me_dispdv = &wsdisplay_console_device->sc_dv;
}
+
+#if NWSMUX == 0
+int
+wsdisplay_set_kbd(struct device *disp, struct wsevsrc *kbd)
+{
+ struct wsdisplay_softc *sc = (struct wsdisplay_softc *)disp;
+
+ if (sc->sc_input != NULL)
+ return (EBUSY);
+
+ sc->sc_input = kbd;
+
+ return (0);
+}
+#endif
+
#endif /* NWSKBD > 0 */
/*