From: Alexey Gladkov <legion@kernel.org>
To: Oleg Bulatov <oleg@bulatov.me>
Cc: kbd@lists.linux.dev
Subject: Re: [PATCH] libkeymap: dump action codes for keycode 0
Date: Sat, 29 Jun 2024 12:24:35 +0200 [thread overview]
Message-ID: <Zn_g49StTyazOBvh@example.org> (raw)
In-Reply-To: <20240621214116.209379-1-oleg@bulatov.me>
On Fri, Jun 21, 2024 at 11:41:09PM +0200, Oleg Bulatov wrote:
> Keymaps in mac/* use keycode 0. For example, mac-qwerty-layout has the
> following definition:
>
> keycode 0 = a
>
> Therefore, dumpkeys should print definitions starting from 0, not 1.
>
> Signed-off-by: Oleg Bulatov <oleg@bulatov.me>
Applied. Thanks!
> ---
> src/libkeymap/dump.c | 4 +--
> .../dumpkeys-fulltable/mac-qwerty-layout.map | 28 +++++++++++++++++++
> .../dumpkeys-fulltable/ruwin_cplk-UTF-8.map | 1 +
> tests/libkeymap.at | 9 ++++++
> 4 files changed, 40 insertions(+), 2 deletions(-)
> create mode 100644 tests/data/dumpkeys-fulltable/mac-qwerty-layout.map
>
> diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c
> index 4dee51b..499cafd 100644
> --- a/src/libkeymap/dump.c
> +++ b/src/libkeymap/dump.c
> @@ -429,7 +429,7 @@ void lk_dump_keys(struct lk_ctx *ctx, FILE *fd, lk_table_shape table, char numer
> if (!(j != ja && lk_map_exists(ctx, j) && lk_map_exists(ctx, ja)))
> continue;
>
> - for (i = 1; i < NR_KEYS; i++) {
> + for (i = 0; i < NR_KEYS; i++) {
> int buf0, buf1, type;
>
> buf0 = lk_get_key(ctx, j, i);
> @@ -455,7 +455,7 @@ void lk_dump_keys(struct lk_ctx *ctx, FILE *fd, lk_table_shape table, char numer
> not_alt_is_meta:
> no_shorthands:
>
> - for (i = 1; i < NR_KEYS; i++) {
> + for (i = 0; i < NR_KEYS; i++) {
> all_holes = 1;
>
> for (j = 0; j < keymapnr; j++) {
> diff --git a/tests/data/dumpkeys-fulltable/mac-qwerty-layout.map b/tests/data/dumpkeys-fulltable/mac-qwerty-layout.map
> new file mode 100644
> index 0000000..8313b0c
> --- /dev/null
> +++ b/tests/data/dumpkeys-fulltable/mac-qwerty-layout.map
> @@ -0,0 +1,28 @@
> +keymaps 0
> +alt_is_meta
> +keycode 0 = a
> +keycode 1 = s
> +keycode 2 = d
> +keycode 3 = f
> +keycode 4 = h
> +keycode 5 = g
> +keycode 6 = z
> +keycode 7 = x
> +keycode 8 = c
> +keycode 9 = v
> +keycode 11 = b
> +keycode 12 = q
> +keycode 13 = w
> +keycode 14 = e
> +keycode 15 = r
> +keycode 16 = y
> +keycode 17 = t
> +keycode 31 = o
> +keycode 32 = u
> +keycode 34 = i
> +keycode 35 = p
> +keycode 37 = l
> +keycode 38 = j
> +keycode 40 = k
> +keycode 45 = n
> +keycode 46 = m
> diff --git a/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map b/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map
> index 80c6672..625b76a 100644
> --- a/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map
> +++ b/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map
> @@ -1,4 +1,5 @@
> keymaps 0-255
> +keycode 0 = 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200
> keycode 1 = 0x001b 0x001b 0x001b 0x001b 0x0200 0x0200 0x0200 0x0200 0x081b 0x0200 0x081b 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200
> keycode 2 = 0x0031 0x0021 0x0031 0x0021 0x0200 0x0200 0x0200 0x0200 0x0831 0x0821 0x0831 0x0821 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200
> keycode 3 = 0x0032 0x0040 0x0032 0x0022 0x0000 0x0200 0x0000 0x0200 0x0832 0x0840 0x0832 0x0840 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200 0x0200
> diff --git a/tests/libkeymap.at b/tests/libkeymap.at
> index 929d1cc..a7f8ccc 100644
> --- a/tests/libkeymap.at
> +++ b/tests/libkeymap.at
> @@ -147,6 +147,15 @@ AT_CHECK([$abs_builddir/helpers/libkeymap-dumpkeys $abs_srcdir/data/dumpkeys-ful
> [0], [expout])
> AT_CLEANUP
>
> +AT_SETUP([test 25 (keycode 0)])
> +AT_KEYWORDS([libkeymap unittest])
> +cp -f -- \
> + "$abs_srcdir/data/dumpkeys-fulltable/mac-qwerty-layout.map" \
> + expout
> +AT_CHECK([$abs_builddir/helpers/libkeymap-dumpkeys $abs_srcdir/data/dumpkeys-fulltable/mac-qwerty-layout.map DEFAULT FALSE],
> + [0], [expout])
> +AT_CLEANUP
> +
> AT_SETUP([binary keymap (us.map)])
> AT_KEYWORDS([libkeymap unittest])
> AT_SKIP_IF([ test "$(arch)" != "x86_64" ])
> --
> 2.44.2
>
>
--
Rgrds, legion
prev parent reply other threads:[~2024-06-29 10:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 21:41 [PATCH] libkeymap: dump action codes for keycode 0 Oleg Bulatov
2024-06-29 10:24 ` Alexey Gladkov [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=Zn_g49StTyazOBvh@example.org \
--to=legion@kernel.org \
--cc=kbd@lists.linux.dev \
--cc=oleg@bulatov.me \
/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