summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/wscons/wscons_callbacks.h4
-rw-r--r--sys/dev/wscons/wsdisplay.c37
-rw-r--r--sys/dev/wscons/wskbd.c38
-rw-r--r--sys/dev/wscons/wsmux.c7
-rw-r--r--sys/dev/wscons/wsmuxvar.h4
5 files changed, 69 insertions, 21 deletions
diff --git a/sys/dev/wscons/wscons_callbacks.h b/sys/dev/wscons/wscons_callbacks.h
index 4f2dd2eef35..6d743f342db 100644
--- a/sys/dev/wscons/wscons_callbacks.h
+++ b/sys/dev/wscons/wscons_callbacks.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wscons_callbacks.h,v 1.6 2005/05/15 11:29:15 miod Exp $ */
+/* $OpenBSD: wscons_callbacks.h,v 1.7 2006/08/05 16:59:57 miod Exp $ */
/* $NetBSD: wscons_callbacks.h,v 1.16 2001/11/10 17:14:51 augustss Exp $ */
/*
@@ -54,6 +54,7 @@ void wsdisplay_set_cons_kbd(int (*get)(dev_t),
void (*poll)(dev_t, int),
void (*bell)(dev_t, u_int, u_int, u_int));
void wsdisplay_unset_cons_kbd(void);
+int wsdisplay_set_kbd(struct device *, struct wsevsrc *);
struct wsdisplay_param;
int wsdisplay_param(struct device*, u_long, struct wsdisplay_param*);
@@ -61,4 +62,5 @@ int wsdisplay_param(struct device*, u_long, struct wsdisplay_param*);
* Calls to the keyboard interface from the glue code.
*/
struct wsevsrc *wskbd_set_console_display(struct device *, struct wsevsrc *);
+int wskbd_set_display(struct device *, struct device *);
int wskbd_pickfree(void);
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 */
/*
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index 504f092b67e..8044fa78a67 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.49 2006/08/01 23:36:52 miod Exp $ */
+/* $OpenBSD: wskbd.c,v 1.50 2006/08/05 16:59:57 miod Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -206,11 +206,6 @@ int wskbd_detach(struct device *, int);
int wskbd_activate(struct device *, enum devact);
int wskbd_displayioctl(struct device *, u_long, caddr_t, int, struct proc *);
-#if NWSDISPLAY > 0
-int wskbd_set_display(struct device *, struct wsevsrc *);
-#else
-#define wskbd_set_display NULL
-#endif
void update_leds(struct wskbd_internal *);
void update_modifier(struct wskbd_internal *, u_int, int, int);
@@ -282,7 +277,12 @@ struct wskbd_keyrepeat_data wskbd_default_keyrepeat_data = {
struct wssrcops wskbd_srcops = {
WSMUX_KBD,
wskbd_mux_open, wskbd_mux_close, wskbd_do_ioctl,
- wskbd_displayioctl, wskbd_set_display
+ wskbd_displayioctl,
+#if NWSDISPLAY > 0
+ wskbd_set_display
+#else
+ NULL
+#endif
};
#endif
@@ -432,6 +432,23 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
}
#endif
+#if NWSMUX == 0
+ if (ap->console == 0) {
+ /*
+ * In the non-wsmux world, always connect wskbd0 and wsdisplay0
+ * together.
+ */
+ extern struct cfdriver wsdisplay_cd;
+
+ if (wsdisplay_cd.cd_ndevs != 0 && self->dv_unit == 0) {
+ if (wskbd_set_display(self,
+ wsdisplay_cd.cd_devs[0]) == 0)
+ wsdisplay_set_kbd(wsdisplay_cd.cd_devs[0],
+ (struct wsevsrc *)sc);
+ }
+ }
+#endif
+
#ifdef HOTKEY_SUPPORT
wskbd_hotkey_init();
#endif
@@ -1179,15 +1196,14 @@ wskbd_set_console_display(struct device *displaydv, struct wsevsrc *me)
}
int
-wskbd_set_display(struct device *dv, struct wsevsrc *me)
+wskbd_set_display(struct device *dv, struct device *displaydv)
{
struct wskbd_softc *sc = (struct wskbd_softc *)dv;
- struct device *displaydv = me != NULL ? me->me_dispdv : NULL;
struct device *odisplaydv;
int error;
- DPRINTF(("wskbd_set_display: %s me=%p odisp=%p disp=%p cons=%d\n",
- dv->dv_xname, me, sc->sc_base.me_dispdv, displaydv,
+ DPRINTF(("wskbd_set_display: %s odisp=%p disp=%p cons=%d\n",
+ dv->dv_xname, sc->sc_base.me_dispdv, displaydv,
sc->sc_isconsole));
if (sc->sc_isconsole)
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index e6e42b54a3b..d3e29f3da38 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.16 2006/04/28 20:06:00 miod Exp $ */
+/* $OpenBSD: wsmux.c,v 1.17 2006/08/05 16:59:57 miod Exp $ */
/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -98,7 +98,7 @@ void wsmux_do_open(struct wsmux_softc *, struct wseventvar *);
void wsmux_do_close(struct wsmux_softc *);
#if NWSDISPLAY > 0
-int wsmux_evsrc_set_display(struct device *, struct wsevsrc *);
+int wsmux_evsrc_set_display(struct device *, struct device *);
#else
#define wsmux_evsrc_set_display NULL
#endif
@@ -757,11 +757,10 @@ wsmux_do_displayioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
* Set display of a mux via the parent mux.
*/
int
-wsmux_evsrc_set_display(struct device *dv, struct wsevsrc *ame)
+wsmux_evsrc_set_display(struct device *dv, struct device *displaydv)
{
struct wsmux_softc *muxsc = (struct wsmux_softc *)ame;
struct wsmux_softc *sc = (struct wsmux_softc *)dv;
- struct device *displaydv = muxsc ? muxsc->sc_displaydv : NULL;
DPRINTF(("wsmux_set_display: %s: displaydv=%p\n",
sc->sc_base.me_dv.dv_xname, displaydv));
diff --git a/sys/dev/wscons/wsmuxvar.h b/sys/dev/wscons/wsmuxvar.h
index fc7c01e4535..ffb42a4728f 100644
--- a/sys/dev/wscons/wsmuxvar.h
+++ b/sys/dev/wscons/wsmuxvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmuxvar.h,v 1.6 2005/05/15 11:29:15 miod Exp $ */
+/* $OpenBSD: wsmuxvar.h,v 1.7 2006/08/05 16:59:57 miod Exp $ */
/* $NetBSD: wsmuxvar.h,v 1.10 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -65,7 +65,7 @@ struct wssrcops {
int (*dclose)(struct wsevsrc *);
int (*dioctl)(struct device *, u_long, caddr_t, int, struct proc *);
int (*ddispioctl)(struct device *, u_long, caddr_t, int, struct proc *);
- int (*dsetdisplay)(struct device *, struct wsevsrc *);
+ int (*dsetdisplay)(struct device *, struct device *);
};
#define wsevsrc_open(me, evp) \