Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Feb 2023 20:33:31 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        imp@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: c51978f4b2f0 - main - kbd: add KBD_DELAY1 and KBD_DELAY2
Message-ID:  <CANCZdfqKfAT84iKXctXbMsg6W75-95G=em0qR-0wLSWAHyMPgA@mail.gmail.com>
In-Reply-To: <66452C86-02AA-4604-B65C-5E32EEBAFCC3@yahoo.com>
References:  <66452C86-02AA-4604-B65C-5E32EEBAFCC3.ref@yahoo.com> <66452C86-02AA-4604-B65C-5E32EEBAFCC3@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000ff705805f5a624ac
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sat, Feb 25, 2023 at 10:03=E2=80=AFAM Mark Millard <marklmi@yahoo.com> w=
rote:

> Warner Losh <imp_at_FreeBSD.org> wrote on
> Date: Sat, 25 Feb 2023 06:26:00 UTC :
>
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3Dc51978f4b2f080c80ddc891c24b151d=
35acb8ba4
> >
> > commit c51978f4b2f080c80ddc891c24b151d35acb8ba4
> > Author:     Michael Paepcke <git@paepcke.de>
> > AuthorDate: 2023-02-18 09:11:37 +0000
> > Commit:     Warner Losh <imp@FreeBSD.org>
> > CommitDate: 2023-02-25 06:19:05 +0000
> >
> >     kbd: add KBD_DELAY1 and KBD_DELAY2
> >
> >     Allow to configure KBD_DELAY* via KERNCONF for user-land less
> embedded
> >     and security appliances
> >
> >     Reviewed by: imp (folded)
> >     Pull Request: https://github.com/freebsd/freebsd-src/pull/649
> > ---
> >  sys/conf/options     | 3 ++-
> >  sys/dev/kbd/kbd.c    | 4 ++--
> >  sys/dev/kbd/kbdreg.h | 8 ++++++--
> >  3 files changed, 10 insertions(+), 5 deletions(-)
> >
> > diff --git a/sys/conf/options b/sys/conf/options
> > index 7855a2f3f20e..42529a90a54e 100644
> > --- a/sys/conf/options
> > +++ b/sys/conf/options
> > @@ -803,8 +803,9 @@ KBD_INSTALL_CDEV  opt_kbd.h
> >  KBD_MAXRETRY         opt_kbd.h
> >  KBD_MAXWAIT          opt_kbd.h
> >  KBD_RESETDELAY               opt_kbd.h
> > +KBD_DELAY1           opt_kbd.h
> > +KBD_DELAY2           opt_kbd.h
> >  KBDIO_DEBUG          opt_kbd.h
> > -
> >  KBDMUX_DFLT_KEYMAP   opt_kbdmux.h
> >
> >  # options for the Atheros driver
> > diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
> > index 205d76639e0f..ebc779de4073 100644
> > --- a/sys/dev/kbd/kbd.c
> > +++ b/sys/dev/kbd/kbd.c
> > @@ -143,8 +143,8 @@ kbd_init_struct(keyboard_t *kbd, char *name, int
> type, int unit, int config,
> >       kbd->kb_accentmap =3D NULL;
> >       kbd->kb_fkeytab =3D NULL;
> >       kbd->kb_fkeytab_size =3D 0;
> > -     kbd->kb_delay1 =3D KB_DELAY1;     /* these values are advisory on=
ly
> */
> > -     kbd->kb_delay2 =3D KB_DELAY2;
> > +     kbd->kb_delay1 =3D KBD_DELAY1;    /* these values are advisory on=
ly
> */
> > +     kbd->kb_delay2 =3D KBD_DELAY2;
> >       kbd->kb_count =3D 0L;
> >       bzero(kbd->kb_lastact, sizeof(kbd->kb_lastact));
> >  }
> > diff --git a/sys/dev/kbd/kbdreg.h b/sys/dev/kbd/kbdreg.h
> > index 15b7e5183f35..2839e259420d 100644
> > --- a/sys/dev/kbd/kbdreg.h
> > +++ b/sys/dev/kbd/kbdreg.h
> > @@ -151,8 +151,12 @@ struct keyboard {
> >       void            *kb_data;       /* the driver's private data */
> >       int             kb_delay1;
> >       int             kb_delay2;
> > -#define KB_DELAY1    500
> > -#define KB_DELAY2    100
> > +#ifndef KBD_DELAY1
> > +#define KBD_DELAY1   500
> > +#endif
> > +#ifndef KBD_DELAY2
> > +#define KBD_DELAY2   100
> > +#endif
>
> [Just reporting Ximalas's Discord note.]
>
> So opt_kbd.h must be included before kbdreg.h in
> order to avoid: macro redefined in opt_kbd.h ?
>
> Should something force the right order?
>

If we include them in the wrong order, then the compiler will complain,
and that's likely sufficient. I'll double check NOTES to make sure that the
values there are different than the defaults.

Warner


> >       unsigned long   kb_count;       /* # of processed key strokes */
> >       u_char          kb_lastact[NUM_KEYS/2];
> >       struct cdev *kb_dev;
>
> =3D=3D=3D
> Mark Millard
> marklmi at yahoo.com
>
>

--000000000000ff705805f5a624ac
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Sat, Feb 25, 2023 at 10:03=E2=80=
=AFAM Mark Millard &lt;<a href=3D"mailto:marklmi@yahoo.com">marklmi@yahoo.c=
om</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
">Warner Losh &lt;imp_at_FreeBSD.org&gt; wrote on<br>
Date: Sat, 25 Feb 2023 06:26:00 UTC :<br>
<br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Dc51978f4b2f0=
80c80ddc891c24b151d35acb8ba4" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3Dc51978f4b2f080c80ddc891c24b151d35acb8ba4<=
/a><br>
&gt; <br>
&gt; commit c51978f4b2f080c80ddc891c24b151d35acb8ba4<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Michael Paepcke &lt;<a href=3D"mailto:git@p=
aepcke.de" target=3D"_blank">git@paepcke.de</a>&gt;<br>
&gt; AuthorDate: 2023-02-18 09:11:37 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2023-02-25 06:19:05 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0kbd: add KBD_DELAY1 and KBD_DELAY2<br>
&gt;=C2=A0 =C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0 =C2=A0Allow to configure KBD_DELAY* via KERNCONF for user=
-land less embedded<br>
&gt;=C2=A0 =C2=A0 =C2=A0and security appliances<br>
&gt;=C2=A0 =C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0 =C2=A0Reviewed by: imp (folded)<br>
&gt;=C2=A0 =C2=A0 =C2=A0Pull Request: <a href=3D"https://github.com/freebsd=
/freebsd-src/pull/649" rel=3D"noreferrer" target=3D"_blank">https://github.=
com/freebsd/freebsd-src/pull/649</a><br>
&gt; ---<br>
&gt;=C2=A0 sys/conf/options=C2=A0 =C2=A0 =C2=A0| 3 ++-<br>
&gt;=C2=A0 sys/dev/kbd/kbd.c=C2=A0 =C2=A0 | 4 ++--<br>
&gt;=C2=A0 sys/dev/kbd/kbdreg.h | 8 ++++++--<br>
&gt;=C2=A0 3 files changed, 10 insertions(+), 5 deletions(-)<br>
&gt; <br>
&gt; diff --git a/sys/conf/options b/sys/conf/options<br>
&gt; index 7855a2f3f20e..42529a90a54e 100644<br>
&gt; --- a/sys/conf/options<br>
&gt; +++ b/sys/conf/options<br>
&gt; @@ -803,8 +803,9 @@ KBD_INSTALL_CDEV=C2=A0 opt_kbd.h<br>
&gt;=C2=A0 KBD_MAXRETRY=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opt_kbd.h<br>
&gt;=C2=A0 KBD_MAXWAIT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 opt_kbd.h<br>
&gt;=C2=A0 KBD_RESETDELAY=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0opt_kbd.h<br>
&gt; +KBD_DELAY1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opt_kbd.h<br>
&gt; +KBD_DELAY2=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opt_kbd.h<br>
&gt;=C2=A0 KBDIO_DEBUG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 opt_kbd.h<br>
&gt; -<br>
&gt;=C2=A0 KBDMUX_DFLT_KEYMAP=C2=A0 =C2=A0opt_kbdmux.h<br>
&gt;=C2=A0 <br>
&gt;=C2=A0 # options for the Atheros driver<br>
&gt; diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c<br>
&gt; index 205d76639e0f..ebc779de4073 100644<br>
&gt; --- a/sys/dev/kbd/kbd.c<br>
&gt; +++ b/sys/dev/kbd/kbd.c<br>
&gt; @@ -143,8 +143,8 @@ kbd_init_struct(keyboard_t *kbd, char *name, int t=
ype, int unit, int config,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_accentmap =3D NULL;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_fkeytab =3D NULL;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_fkeytab_size =3D 0;<br>
&gt; -=C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_delay1 =3D KB_DELAY1;=C2=A0 =C2=A0 =C2=
=A0/* these values are advisory only */<br>
&gt; -=C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_delay2 =3D KB_DELAY2;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_delay1 =3D KBD_DELAY1;=C2=A0 =C2=A0 /*=
 these values are advisory only */<br>
&gt; +=C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_delay2 =3D KBD_DELAY2;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0kbd-&gt;kb_count =3D 0L;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0bzero(kbd-&gt;kb_lastact, sizeof(kbd-&gt;kb_=
lastact));<br>
&gt;=C2=A0 }<br>
&gt; diff --git a/sys/dev/kbd/kbdreg.h b/sys/dev/kbd/kbdreg.h<br>
&gt; index 15b7e5183f35..2839e259420d 100644<br>
&gt; --- a/sys/dev/kbd/kbdreg.h<br>
&gt; +++ b/sys/dev/kbd/kbdreg.h<br>
&gt; @@ -151,8 +151,12 @@ struct keyboard {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0void=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 *kb_data;=C2=A0 =C2=A0 =C2=A0 =C2=A0/* the driver&#39;s private data */=
<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0kb_delay1;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0kb_delay2;<br>
&gt; -#define KB_DELAY1=C2=A0 =C2=A0 500<br>
&gt; -#define KB_DELAY2=C2=A0 =C2=A0 100<br>
&gt; +#ifndef KBD_DELAY1<br>
&gt; +#define KBD_DELAY1=C2=A0 =C2=A0500<br>
&gt; +#endif<br>
&gt; +#ifndef KBD_DELAY2<br>
&gt; +#define KBD_DELAY2=C2=A0 =C2=A0100<br>
&gt; +#endif<br>
<br>
[Just reporting Ximalas&#39;s Discord note.]<br>
<br>
So opt_kbd.h must be included before kbdreg.h in<br>
order to avoid: macro redefined in opt_kbd.h ?<br>
<br>
Should something force the right order?<br></blockquote><div><br></div><div=
>If we include them in the wrong order, then the compiler will complain,</d=
iv><div>and that&#39;s likely sufficient. I&#39;ll double check NOTES to ma=
ke sure that the</div><div>values there are different than the defaults.</d=
iv><div><br></div><div>Warner<br></div><div>=C2=A0</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long=C2=A0 =C2=A0kb_count;=C2=A0 =
=C2=A0 =C2=A0 =C2=A0/* # of processed key strokes */<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0u_char=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kb_=
lastact[NUM_KEYS/2];<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0struct cdev *kb_dev;<br>
<br>
=3D=3D=3D<br>
Mark Millard<br>
marklmi at <a href=3D"http://yahoo.com" rel=3D"noreferrer" target=3D"_blank=
">yahoo.com</a><br>
<br>
</blockquote></div></div>

--000000000000ff705805f5a624ac--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqKfAT84iKXctXbMsg6W75-95G=em0qR-0wLSWAHyMPgA>