On 10/04/18(Tue) 11:57, Mark Kettenis wrote:
> > Date: Tue, 27 Mar 2018 13:40:02 +0200
> > From: Martin Pieuchot <[email protected]>
> >
> > On 05/02/18(Mon) 18:31, Artturi Alm wrote:
> > > On Mon, Feb 05, 2018 at 02:51:48PM +0100, Martin Pieuchot wrote:
> > > > On 04/02/18(Sun) 11:28, Artturi Alm wrote:
> > > > > Hi,
> > > > >
> > > > > machdep.forceukbd=1 feels broken to me, as i use "sv", and it doesn't
> > > > > respect
> > > > > /etc/kbdtype.
> > > >
> > > > If you unplug/replug your USB keyboard after having booted does it
> > > > respect /etc/kbdtype?
> > >
> > > Yes, no issues when machdep.forceukbd=0, and i do that unplug/replug-dance
> > > "in software" several times a day, as i use the same mouse+keyboard
> > > on my VM for games.
> >
> > Diff below fixes the problem. Turns out that the layout configured with
> > kbd(8) is stored in the mux. But the value of the mux wasn't read for
> > console keyboard since it is supposed to attach first.
> >
> > Index: dev/wscons/wskbd.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/wscons/wskbd.c,v
> > retrieving revision 1.90
> > diff -u -p -r1.90 wskbd.c
> > --- dev/wscons/wskbd.c 19 Feb 2018 08:59:52 -0000 1.90
> > +++ dev/wscons/wskbd.c 27 Mar 2018 11:35:51 -0000
> > @@ -373,21 +373,11 @@ wskbd_attach(struct device *parent, stru
> > #endif
> > #if NWSMUX > 0
> > mux = sc->sc_base.me_dv.dv_cfdata->wskbddevcf_mux;
> > - if (ap->console) {
> > - /* Ignore mux for console; it always goes to the console mux. */
> > - /* printf(" (mux %d ignored for console)", mux); */
> > - mux = -1;
> > - }
> > if (mux >= 0) {
> > printf(" mux %d", mux);
>
> Should this printf be skipped for the console?
I don't mind, if we go this way here's a diff.
Index: dev/wscons/wskbd.c
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wskbd.c,v
retrieving revision 1.90
diff -u -p -r1.90 wskbd.c
--- dev/wscons/wskbd.c 19 Feb 2018 08:59:52 -0000 1.90
+++ dev/wscons/wskbd.c 10 Apr 2018 10:37:53 -0000
@@ -362,7 +362,7 @@ wskbd_attach(struct device *parent, stru
struct wskbddev_attach_args *ap = aux;
kbd_t layout;
#if NWSMUX > 0
- struct wsmux_softc *wsmux_sc;
+ struct wsmux_softc *wsmux_sc = NULL;
int mux, error;
#endif
@@ -373,21 +373,8 @@ wskbd_attach(struct device *parent, stru
#endif
#if NWSMUX > 0
mux = sc->sc_base.me_dv.dv_cfdata->wskbddevcf_mux;
- if (ap->console) {
- /* Ignore mux for console; it always goes to the console mux. */
- /* printf(" (mux %d ignored for console)", mux); */
- mux = -1;
- }
- if (mux >= 0) {
- printf(" mux %d", mux);
+ if (mux >= 0)
wsmux_sc = wsmux_getmux(mux);
- } else
- wsmux_sc = NULL;
-#else
-#if 0 /* not worth keeping, especially since the default value is not -1... */
- if (sc->sc_base.me_dv.dv_cfdata->wskbddevcf_mux >= 0)
- printf(" (mux ignored)");
-#endif
#endif /* NWSMUX > 0 */
if (ap->console) {
@@ -459,14 +446,14 @@ wskbd_attach(struct device *parent, stru
printf(", using %s", sc->sc_displaydv->dv_xname);
#endif
}
- printf("\n");
#if NWSMUX > 0
- if (wsmux_sc != NULL) {
+ /* Ignore mux for console; it always goes to the console mux. */
+ if (wsmux_sc != NULL && ap->console == 0) {
+ printf(" mux %d", mux);
error = wsmux_attach_sc(wsmux_sc, &sc->sc_base);
if (error)
- printf("%s: attach error=%d\n",
- sc->sc_base.me_dv.dv_xname, error);
+ printf(": attach error=%d", error);
/*
* Try and set this encoding as the mux default if it
@@ -479,6 +466,7 @@ wskbd_attach(struct device *parent, stru
wsmux_set_layout(wsmux_sc, layout);
}
#endif
+ printf("\n");
#if NWSDISPLAY > 0 && NWSMUX == 0
if (ap->console == 0) {