amd64/machdep knob: forceukb forcing wrong encoding.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

amd64/machdep knob: forceukb forcing wrong encoding.

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

Reply | Threaded
Open this post in threaded view
|

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

Jason McIntyre-2
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

Reply | Threaded
Open this post in threaded view
|

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

Landry Breuil-5
On Sun, Feb 04, 2018 at 09:32:41AM +0000, 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..

Reply | Threaded
Open this post in threaded view
|

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

Martin Pieuchot
In reply to this post by Artturi Alm
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?

Reply | Threaded
Open this post in threaded view
|

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

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

Reply | Threaded
Open this post in threaded view
|

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

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 -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);
  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 | Threaded
Open this post in threaded view
|

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

Mark Kettenis
> Date: Tue, 27 Mar 2018 13:40:02 +0200
> From: Martin Pieuchot <[hidden email]>
>
> 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 | Threaded
Open this post in threaded view
|

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

Martin Pieuchot
On 10/04/18(Tue) 11:57, Mark Kettenis wrote:

> > Date: Tue, 27 Mar 2018 13:40:02 +0200
> > From: Martin Pieuchot <[hidden email]>
> >
> > 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) {