Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-04-10 Thread Martin Pieuchot
On 10/04/18(Tue) 11:57, Mark Kettenis wrote:
> > Date: Tue, 27 Mar 2018 13:40:02 +0200
> > From: Martin Pieuchot 
> > 
> > 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 -  1.90
> > +++ dev/wscons/wskbd.c  27 Mar 2018 11:35:51 -
> > @@ -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 -  1.90
+++ dev/wscons/wskbd.c  10 Apr 2018 10:37:53 -
@@ -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) {



Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-04-10 Thread Mark Kettenis
> Date: Tue, 27 Mar 2018 13:40:02 +0200
> From: Martin Pieuchot 
> 
> 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.c19 Feb 2018 08:59:52 -  1.90
> +++ dev/wscons/wskbd.c27 Mar 2018 11:35:51 -
> @@ -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",
> 
> 



Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-04-10 Thread Martin Pieuchot
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 -  1.90
+++ dev/wscons/wskbd.c  27 Mar 2018 11:35:51 -
@@ -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);
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",



Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-02-05 Thread Artturi Alm
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.

-Artturi



Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-02-05 Thread Martin Pieuchot
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?



Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-02-04 Thread Landry Breuil
On Sun, Feb 04, 2018 at 09:32:41AM +, Jason McIntyre wrote:
> On Sun, Feb 04, 2018 at 11:28:31AM +0200, Artturi Alm wrote:
> > Hi,
> > 
> > machdep.forceukbd=1 feels broken to me, as i use "sv", and it doesn't 
> > respect
> > /etc/kbdtype.
> > caused nothing but my time being (not-so-well-)wasted, because i forgot 
> > having
> > just added forceukbd=1 && this 'quirk' being undocumented. so maybe a 
> > docbug.
> > 
> > just wanted to make a note of this somewhere, sry4noise..
> > -Artturi
> > 
> 
> morning.
> 
> i ran into this this week too. i think it is a bug in its behaviour, not
> a doc bug.

I've seen it too, which doesnt help when at the same time you have an
azerty and a qwerty kbd, /etc/kbdtype set to fr, with forceukbd=1 both
end up having a 'funny' behaviour..



Re: amd64/machdep knob: forceukb forcing wrong encoding.

2018-02-04 Thread Jason McIntyre
On Sun, Feb 04, 2018 at 11:28:31AM +0200, Artturi Alm wrote:
> Hi,
> 
> machdep.forceukbd=1 feels broken to me, as i use "sv", and it doesn't respect
> /etc/kbdtype.
> caused nothing but my time being (not-so-well-)wasted, because i forgot having
> just added forceukbd=1 && this 'quirk' being undocumented. so maybe a docbug.
> 
> just wanted to make a note of this somewhere, sry4noise..
> -Artturi
> 

morning.

i ran into this this week too. i think it is a bug in its behaviour, not
a doc bug.

jmc



amd64/machdep knob: forceukb forcing wrong encoding.

2018-02-04 Thread Artturi Alm
Hi,

machdep.forceukbd=1 feels broken to me, as i use "sv", and it doesn't respect
/etc/kbdtype.
caused nothing but my time being (not-so-well-)wasted, because i forgot having
just added forceukbd=1 && this 'quirk' being undocumented. so maybe a docbug.

just wanted to make a note of this somewhere, sry4noise..
-Artturi