> Date: Tue, 27 Mar 2018 13:40:02 +0200
> From: Martin Pieuchot <m...@openbsd.org>
> 
> 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?

>               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) {
> @@ -462,7 +452,8 @@ wskbd_attach(struct device *parent, stru
>       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) {
>               error = wsmux_attach_sc(wsmux_sc, &sc->sc_base);
>               if (error)
>                       printf("%s: attach error=%d\n",
> 
> 

Reply via email to