mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nir Lichtman <nir@lichtman.org>
To: Doug Anderson <dianders@chromium.org>
Cc: jason.wessel@windriver.com, daniel.thompson@linaro.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kdb: fix ctrl+e/a/f/b/d/p/n broken in keyboard mode
Date: Sat, 9 Nov 2024 07:35:11 +0000	[thread overview]
Message-ID: <20241109073511.GA128495@lichtman.org> (raw)
In-Reply-To: <CAD=FV=X6oS+v-ZvJWsHYAnfVg0Lurt8z4aYaboDKkib=p4zyJw@mail.gmail.com>

On Fri, Nov 08, 2024 at 04:31:12PM -0800, Doug Anderson wrote:
> Hi,
> 
> On Fri, Nov 8, 2024 at 2:11 PM Nir Lichtman <nir@lichtman.org> wrote:
> >
> > Problem: When using KDB via keyboard it does not react to control
> > characters which are supported in serial mode.
> >
> > I have took them all besides the TAB control character translation (I am
> > not sure what that maps to on the keyboard)
> 
> Tab translates to 9, so the 9th character. Ctrl-I.

Noted, thanks

> 
> 
> >  kernel/debug/kdb/kdb_keyboard.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/kernel/debug/kdb/kdb_keyboard.c b/kernel/debug/kdb/kdb_keyboard.c
> > index 3c2987f46f6e..2c004abd5375 100644
> > --- a/kernel/debug/kdb/kdb_keyboard.c
> > +++ b/kernel/debug/kdb/kdb_keyboard.c
> > @@ -172,6 +172,9 @@ int kdb_get_kbd_char(void)
> >         switch (KTYP(keychar)) {
> >         case KT_LETTER:
> >         case KT_LATIN:
> > +               if (keychar == 4 || keychar == 1 || keychar == 5 || keychar == 2 ||
> > +                   keychar == 16 || keychar == 14 || keychar == 6)
> > +                       return keychar;         /* non-printable supported control characters (e.g. CTRL+A) */
> 
> This is probably OK, but IMO readability here (and above) could be
> improved. Untested, but I think:
> 
> #define CTRL(c) (c - 64)

That's a good point, I will work on a v2 with this fix.

> 
> Then:
> 
> /* Allowlist supported control characters */
> switch(keychar) {
> case CTRL('A'): /* Home */
[...]

Thanks,
Nir

      reply	other threads:[~2024-11-09  7:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 22:11 Nir Lichtman
2024-11-09  0:31 ` Doug Anderson
2024-11-09  7:35   ` Nir Lichtman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241109073511.GA128495@lichtman.org \
    --to=nir@lichtman.org \
    --cc=daniel.thompson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®