Subject: wskbd isn't connected to wsdisplay
To: None <tech-kern@netbsd.org>
From: TAKEMURA Shin <takemura_shin@hotmail.com>
List: tech-kern
Date: 02/24/2002 14:53:55
This is a multi-part message in MIME format.
------=_NextPart_000_0023_01C1BD43.152ACEB0
Content-Type: text/plain;
charset="iso-2022-jp"
Content-Transfer-Encoding: 7bit
Hi there,
I found a problem that wskbd wan't connected to any display
if keyboard was attached before display and both aren't console.
In this case, you can't input any key to terminal.
The problem is that wsdisplay just initialize me_dispdv member
of wsevsrc structure directly and doesn't care of children
(keyboards) of wsmux in wsdisplay_common_attach.
I've made a patch to fix the problem (attached).
If no one object, I will commit the patch in few days.
Takemura
------=_NextPart_000_0023_01C1BD43.152ACEB0
Content-Type: application/octet-stream;
name="wscons.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="wscons.patch"
Index: wsdisplay.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsdisplay.c,v=0A=
retrieving revision 1.60=0A=
diff -c -r1.60 wsdisplay.c=0A=
*** wsdisplay.c 2001/11/13 06:17:46 1.60=0A=
--- wsdisplay.c 2002/02/24 06:02:27=0A=
***************=0A=
*** 562,578 ****=0A=
#if NWSKBD > 0=0A=
struct wsevsrc *kme;=0A=
#if NWSMUX > 0=0A=
! struct wsevsrc *inp;=0A=
=0A=
if (kbdmux >=3D 0)=0A=
! inp =3D &wsmux_getmux(kbdmux)->sc_base;=0A=
else=0A=
! inp =3D &wsmux_create("dmux", sc->sc_dv.dv_unit)->sc_base;=0A=
/* XXX panic()ing isn't nice, but attach cannot fail */=0A=
! if (inp =3D=3D NULL)=0A=
panic("wsdisplay_common_attach: no memory\n");=0A=
! sc->sc_input =3D inp;=0A=
! inp->me_dispdv =3D &sc->sc_dv;=0A=
printf(" kbdmux %d", kbdmux);=0A=
#else=0A=
if (kbdmux >=3D 0)=0A=
--- 562,578 ----=0A=
#if NWSKBD > 0=0A=
struct wsevsrc *kme;=0A=
#if NWSMUX > 0=0A=
! struct wsmux_softc *mux;=0A=
=0A=
if (kbdmux >=3D 0)=0A=
! mux =3D wsmux_getmux(kbdmux);=0A=
else=0A=
! mux =3D wsmux_create("dmux", sc->sc_dv.dv_unit);=0A=
/* XXX panic()ing isn't nice, but attach cannot fail */=0A=
! if (mux =3D=3D NULL)=0A=
panic("wsdisplay_common_attach: no memory\n");=0A=
! sc->sc_input =3D &mux->sc_base;=0A=
! mux->sc_base.me_dispdv =3D &sc->sc_dv;=0A=
printf(" kbdmux %d", kbdmux);=0A=
#else=0A=
if (kbdmux >=3D 0)=0A=
***************=0A=
*** 607,612 ****=0A=
--- 607,616 ----=0A=
start =3D 1;=0A=
}=0A=
printf("\n");=0A=
+ =0A=
+ #if NWSKBD > 0 && NWSMUX > 0=0A=
+ wsmux_set_display(mux, &sc->sc_dv);=0A=
+ #endif=0A=
=0A=
sc->sc_accessops =3D accessops;=0A=
sc->sc_accesscookie =3D accesscookie;=0A=
Index: wsmux.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsmux.c,v=0A=
retrieving revision 1.27=0A=
diff -c -r1.27 wsmux.c=0A=
*** wsmux.c 2002/01/12 16:41:03 1.27=0A=
--- wsmux.c 2002/02/24 06:02:29=0A=
***************=0A=
*** 102,110 ****=0A=
=0A=
static void wsmux_do_close(struct wsmux_softc *);=0A=
#if NWSDISPLAY > 0=0A=
! static int wsmux_set_display(struct device *, struct wsevsrc *);=0A=
#else=0A=
! #define wsmux_set_display NULL=0A=
#endif=0A=
=0A=
static int wsmux_do_displayioctl(struct device *dev, u_long cmd,=0A=
--- 102,110 ----=0A=
=0A=
static void wsmux_do_close(struct wsmux_softc *);=0A=
#if NWSDISPLAY > 0=0A=
! static int wsmux_evsrc_set_display(struct device *, struct wsevsrc *);=0A=
#else=0A=
! #define wsmux_evsrc_set_display NULL=0A=
#endif=0A=
=0A=
static int wsmux_do_displayioctl(struct device *dev, u_long cmd,=0A=
***************=0A=
*** 123,129 ****=0A=
struct wssrcops wsmux_srcops =3D {=0A=
WSMUX_MUX,=0A=
wsmux_mux_open, wsmux_mux_close, wsmux_do_ioctl, =
wsmux_do_displayioctl,=0A=
! wsmux_set_display=0A=
};=0A=
=0A=
/* From upper level */=0A=
--- 123,129 ----=0A=
struct wssrcops wsmux_srcops =3D {=0A=
WSMUX_MUX,=0A=
wsmux_mux_open, wsmux_mux_close, wsmux_do_ioctl, =
wsmux_do_displayioctl,=0A=
! wsmux_evsrc_set_display=0A=
};=0A=
=0A=
/* From upper level */=0A=
***************=0A=
*** 763,777 ****=0A=
* Set display of a mux via the parent mux.=0A=
*/=0A=
int=0A=
! wsmux_set_display(struct device *dv, struct wsevsrc *ame)=0A=
{=0A=
struct wsmux_softc *muxsc =3D (struct wsmux_softc *)ame;=0A=
struct wsmux_softc *sc =3D (struct wsmux_softc *)dv;=0A=
- struct wsmux_softc *nsc =3D muxsc ? sc : NULL;=0A=
struct device *displaydv =3D muxsc ? muxsc->sc_base.me_dispdv : NULL;=0A=
- struct device *odisplaydv;=0A=
- struct wsevsrc *me;=0A=
- int error, ok;=0A=
=0A=
DPRINTF(("wsmux_set_display: %s: displaydv=3D%p\n",=0A=
sc->sc_base.me_dv.dv_xname, displaydv));=0A=
--- 763,773 ----=0A=
* Set display of a mux via the parent mux.=0A=
*/=0A=
int=0A=
! wsmux_evsrc_set_display(struct device *dv, struct wsevsrc *ame)=0A=
{=0A=
struct wsmux_softc *muxsc =3D (struct wsmux_softc *)ame;=0A=
struct wsmux_softc *sc =3D (struct wsmux_softc *)dv;=0A=
struct device *displaydv =3D muxsc ? muxsc->sc_base.me_dispdv : NULL;=0A=
=0A=
DPRINTF(("wsmux_set_display: %s: displaydv=3D%p\n",=0A=
sc->sc_base.me_dv.dv_xname, displaydv));=0A=
***************=0A=
*** 783,788 ****=0A=
--- 779,795 ----=0A=
if (sc->sc_base.me_dispdv =3D=3D NULL)=0A=
return (ENXIO);=0A=
}=0A=
+ =0A=
+ return wsmux_set_display(sc, displaydv);=0A=
+ }=0A=
+ =0A=
+ int=0A=
+ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)=0A=
+ {=0A=
+ struct device *odisplaydv;=0A=
+ struct wsevsrc *me;=0A=
+ struct wsmux_softc *nsc =3D displaydv ? sc : NULL;=0A=
+ int error, ok;=0A=
=0A=
odisplaydv =3D sc->sc_base.me_dispdv;=0A=
sc->sc_base.me_dispdv =3D displaydv;=0A=
Index: wsmuxvar.h=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsmuxvar.h,v=0A=
retrieving revision 1.6=0A=
diff -c -r1.6 wsmuxvar.h=0A=
*** wsmuxvar.h 2001/10/27 00:39:29 1.6=0A=
--- wsmuxvar.h 2002/02/24 06:02:29=0A=
***************=0A=
*** 91,96 ****=0A=
--- 91,97 ----=0A=
struct wsmux_softc *wsmux_create(const char *, int);=0A=
int wsmux_attach_sc(struct wsmux_softc *, struct wsevsrc *);=0A=
void wsmux_detach_sc(struct wsevsrc *);=0A=
+ int wsmux_set_display(struct wsmux_softc *, struct device *);=0A=
=0A=
int wskbd_add_mux(int, struct wsmux_softc *);=0A=
int wsmouse_add_mux(int, struct wsmux_softc *);=0A=
------=_NextPart_000_0023_01C1BD43.152ACEB0--