Added wsmux_set_display() to fix the problem that wskbd wan't connected

to any display if keyboard was attached before display and both aren't console.
This commit is contained in:
takemura 2002-03-02 08:22:26 +00:00
parent b7a4d57a9e
commit 29e873a235
3 changed files with 31 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.60 2001/11/13 06:17:46 lukem Exp $ */
/* $NetBSD: wsdisplay.c,v 1.61 2002/03/02 08:22:26 takemura Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.60 2001/11/13 06:17:46 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.61 2002/03/02 08:22:26 takemura Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_compat_netbsd.h"
@ -562,17 +562,17 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
#if NWSKBD > 0
struct wsevsrc *kme;
#if NWSMUX > 0
struct wsevsrc *inp;
struct wsmux_softc *mux;
if (kbdmux >= 0)
inp = &wsmux_getmux(kbdmux)->sc_base;
mux = wsmux_getmux(kbdmux);
else
inp = &wsmux_create("dmux", sc->sc_dv.dv_unit)->sc_base;
mux = wsmux_create("dmux", sc->sc_dv.dv_unit);
/* XXX panic()ing isn't nice, but attach cannot fail */
if (inp == NULL)
if (mux == NULL)
panic("wsdisplay_common_attach: no memory\n");
sc->sc_input = inp;
inp->me_dispdv = &sc->sc_dv;
sc->sc_input = &mux->sc_base;
mux->sc_base.me_dispdv = &sc->sc_dv;
printf(" kbdmux %d", kbdmux);
#else
if (kbdmux >= 0)
@ -608,6 +608,10 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
}
printf("\n");
#if NWSKBD > 0 && NWSMUX > 0
wsmux_set_display(mux, &sc->sc_dv);
#endif
sc->sc_accessops = accessops;
sc->sc_accesscookie = accesscookie;
sc->sc_scrdata = scrdata;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsmux.c,v 1.27 2002/01/12 16:41:03 tsutsui Exp $ */
/* $NetBSD: wsmux.c,v 1.28 2002/03/02 08:22:28 takemura Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.27 2002/01/12 16:41:03 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.28 2002/03/02 08:22:28 takemura Exp $");
#include "wsdisplay.h"
#include "wsmux.h"
@ -102,9 +102,9 @@ static void wsmux_do_open(struct wsmux_softc *, struct wseventvar *);
static void wsmux_do_close(struct wsmux_softc *);
#if NWSDISPLAY > 0
static int wsmux_set_display(struct device *, struct wsevsrc *);
static int wsmux_evsrc_set_display(struct device *, struct wsevsrc *);
#else
#define wsmux_set_display NULL
#define wsmux_evsrc_set_display NULL
#endif
static int wsmux_do_displayioctl(struct device *dev, u_long cmd,
@ -123,7 +123,7 @@ cdev_decl(wsmux);
struct wssrcops wsmux_srcops = {
WSMUX_MUX,
wsmux_mux_open, wsmux_mux_close, wsmux_do_ioctl, wsmux_do_displayioctl,
wsmux_set_display
wsmux_evsrc_set_display
};
/* From upper level */
@ -763,15 +763,11 @@ 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_set_display(struct device *dv, struct wsevsrc *ame)
wsmux_evsrc_set_display(struct device *dv, struct wsevsrc *ame)
{
struct wsmux_softc *muxsc = (struct wsmux_softc *)ame;
struct wsmux_softc *sc = (struct wsmux_softc *)dv;
struct wsmux_softc *nsc = muxsc ? sc : NULL;
struct device *displaydv = muxsc ? muxsc->sc_base.me_dispdv : NULL;
struct device *odisplaydv;
struct wsevsrc *me;
int error, ok;
DPRINTF(("wsmux_set_display: %s: displaydv=%p\n",
sc->sc_base.me_dv.dv_xname, displaydv));
@ -784,6 +780,17 @@ wsmux_set_display(struct device *dv, struct wsevsrc *ame)
return (ENXIO);
}
return wsmux_set_display(sc, displaydv);
}
int
wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)
{
struct device *odisplaydv;
struct wsevsrc *me;
struct wsmux_softc *nsc = displaydv ? sc : NULL;
int error, ok;
odisplaydv = sc->sc_base.me_dispdv;
sc->sc_base.me_dispdv = displaydv;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsmuxvar.h,v 1.6 2001/10/27 00:39:29 augustss Exp $ */
/* $NetBSD: wsmuxvar.h,v 1.7 2002/03/02 08:22:28 takemura Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -91,6 +91,7 @@ struct wsmux_softc *wsmux_getmux(int);
struct wsmux_softc *wsmux_create(const char *, int);
int wsmux_attach_sc(struct wsmux_softc *, struct wsevsrc *);
void wsmux_detach_sc(struct wsevsrc *);
int wsmux_set_display(struct wsmux_softc *, struct device *);
int wskbd_add_mux(int, struct wsmux_softc *);
int wsmouse_add_mux(int, struct wsmux_softc *);