keycodemapdb.git
2 months agoAdd .gitattributes file master
Andrea Bolognani [Tue, 22 Mar 2022 10:20:52 +0000 (11:20 +0100)] 
Add .gitattributes file

The files marked as export-ignore here are not going to be
included in the tarball produced by 'meson dist' when using
meson >= 0.60. Older versions of meson excluded some files
automatically, but that no longer happens.

Note that, while keycodemapdb itself doesn't use meson or
really produce release tarballs, the presence of this file
will help meson-using projects that include it as a git
submodule - for example libvirt.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 months agoadd more japanese mappings
gsittyz [Sun, 14 Feb 2021 06:18:37 +0000 (15:18 +0900)] 
add more japanese mappings

10 months agoAdd QEMU QKeyCode "lang1" and "lang2"
Akihiko Odaki [Tue, 15 Jun 2021 15:08:06 +0000 (00:08 +0900)] 
Add QEMU QKeyCode "lang1" and "lang2"

This corresponds to commit d7696ff884e35c6dacf83a7cbe3355e3b0a90125
of https://gitlab.com/qemu-project/qemu.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
14 months agorust: fix cargo clippy
Marc-André Lureau [Sun, 7 Mar 2021 21:10:11 +0000 (01:10 +0400)] 
rust: fix cargo clippy

Fix clippy error about missing main().

Fix various clippy warnings "help: consider removing `'static`: `&str`"

Run clippy with the rust test.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
15 months agotests: add rust test
Marc-André Lureau [Fri, 12 Feb 2021 08:57:44 +0000 (12:57 +0400)] 
tests: add rust test

15 months agogen: add --lang rust
Marc-André Lureau [Fri, 12 Feb 2021 08:52:11 +0000 (12:52 +0400)] 
gen: add --lang rust

The static maps use the phf crate.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
15 months agotests: fix argument order
Marc-André Lureau [Fri, 12 Feb 2021 08:16:48 +0000 (12:16 +0400)] 
tests: fix argument order

Fixes: 7381b9bfadd31c ("Introduce separate args for title & subtitle
with docs generator")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
18 months agoFix scan codes for Korean keys
Pierre Ossman [Wed, 11 Nov 2020 12:43:22 +0000 (13:43 +0100)] 
Fix scan codes for Korean keys

No idea where the previous values are from, but they are not supported
by any information we can find now.

18 months agoFix argument order in output headers
Pierre Ossman [Wed, 11 Nov 2020 09:51:40 +0000 (10:51 +0100)] 
Fix argument order in output headers

The sub-command needs to come before all other arguments.

18 months agoAdd HTML entries for Korean layout keys
Pierre Ossman [Wed, 11 Nov 2020 09:16:30 +0000 (10:16 +0100)] 
Add HTML entries for Korean layout keys

18 months agoAdd macOS entries for Japanese keyboards
Pierre Ossman [Wed, 11 Nov 2020 09:13:34 +0000 (10:13 +0100)] 
Add macOS entries for Japanese keyboards

Apple has a different layout for their Japanese keyboards compared to PC
and are reusing the scan codes used on Korean layouts for their special
keys.

2 years agoFix win32 keycode for VK_OEM_102 github/master
Volker Rümelin [Wed, 29 Apr 2020 18:42:50 +0000 (20:42 +0200)] 
Fix win32 keycode for VK_OEM_102

The win32 keycode for VK_OEM_102 is 0xe2. The Microsoft docu-
mentation for virtual-key codes agrees with mingw32/winuser.h.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
2 years agoAdd support for generating RST formatted docs pages
Daniel P. Berrangé [Fri, 6 Dec 2019 13:17:39 +0000 (13:17 +0000)] 
Add support for generating RST formatted docs pages

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoIntroduce separate args for title & subtitle with docs generator
Daniel P. Berrangé [Fri, 6 Dec 2019 13:17:06 +0000 (13:17 +0000)] 
Introduce separate args for title & subtitle with docs generator

With this change the calling conversion is different, the --varname
arg must be after the command name.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agokeymap-gen: Name sections in pod output
Andrea Bolognani [Mon, 15 Apr 2019 12:31:11 +0000 (14:31 +0200)] 
keymap-gen: Name sections in pod output

Properly formatted man pages have at least a NAME section,
which tools like apropos(1) parse and index.

The current implementation of PodLanguageGenerator doesn't
generate this section, and even if the user were to try and
work around the limitation by passing --varname=NAME, there
would still be nothing in the section to actually parse.

Change the generator so that varname will be used as the
contents of the NAME section, add a DESCRIPTION section in
which values are listed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoAdd an empty meson project 7/head
Marc-André Lureau [Fri, 15 Feb 2019 19:43:11 +0000 (19:43 +0000)] 
Add an empty meson project

This allows to make keycodemapdb a subproject() in meson.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
4 years agoremove buildtime from generated files 6/head
Olaf Hering [Wed, 21 Feb 2018 09:46:54 +0000 (10:46 +0100)] 
remove buildtime from generated files

Each rebuild gets a different file even if the sources are unchanged.
Debian sells this as "reproducible build".
SUSE just wants to avoid needless republish of otherwise identical binaries.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
4 years agoadd header file generators
Paolo Bonzini [Thu, 1 Feb 2018 19:21:36 +0000 (14:21 -0500)] 
add header file generators

keymap-gen can create header files that include the length of the array.  Using
ARRAY_SIZE on the array becomes then possible, and this can be preferrable to
the "x_len" symbols because static analysis cannot necessarily see the value of
"x_len".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoc++: add extern declaration to the generated file
Paolo Bonzini [Thu, 1 Feb 2018 19:06:55 +0000 (14:06 -0500)] 
c++: add extern declaration to the generated file

The extern declaration affects how the C++ compiler does name mangling of global
variables.  With:

    $ g++ -c -Wall -std=c++11 -o osx2win32.o osx2win32.cc
    $ nm osx2win32.o | grep code_map_osx_to_win32
    0000000000000000 B code_map_osx_to_win32
    00000000000000a1 t _GLOBAL__sub_I_code_map_osx_to_win32

Without:

    $ g++ -c -Wall -std=c++11 -o osx2win32.o osx2win32.cc
    $ nm osx2win32.o | grep code_map_osx_to_win32
    0000000000000000 b _ZL21code_map_osx_to_win32

Not that unlike C, without "extern" you get a local variable ("b"), while
"extern" is needed to get a global!

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomove CLanguageGenerator closer to CLanguageGenerator itself
Paolo Bonzini [Thu, 1 Feb 2018 19:05:41 +0000 (14:05 -0500)] 
move CLanguageGenerator closer to CLanguageGenerator itself

This is a small aesthetic change before introducing the generator subclasses
for C and C++ header files; place each subclass close to the superclass.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoFix compat with py3 dict keys/values data types
Daniel P. Berrange [Fri, 12 Jan 2018 13:53:44 +0000 (13:53 +0000)] 
Fix compat with py3 dict keys/values data types

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd missing QKeyCode values for JIS keyboards
Miika S [Mon, 18 Dec 2017 10:53:16 +0000 (10:53 +0000)] 
Add missing QKeyCode values for JIS keyboards

The AT set1 code for KEY_ISO is removed because it conflicts with
KEY_KATAKANAHIRAGANA.

Signed-off-by: Miika S <miika9764@gmail.com>
4 years agoFix mistake in Pause/SysRq mapping for SUN scancode
Daniel P. Berrange [Thu, 19 Oct 2017 13:32:16 +0000 (14:32 +0100)] 
Fix mistake in Pause/SysRq mapping for SUN scancode

The 0x15 scancode is actually referring to Pause, but was
mistakenly recorded as a second scancode for SysRq

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd hack for mapping qnum 0xb7 to sysrq
Daniel P. Berrange [Thu, 19 Oct 2017 13:11:58 +0000 (14:11 +0100)] 
Add hack for mapping qnum 0xb7 to sysrq

Historical versions of QEMU allowed both 0x54 and 0xb7 to trigger
a print/sysrq key. Although 0x54 is preferred, we must cope with
0xb7 for backwards compat.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd local argparse for compat with python 2.6
Daniel P. Berrange [Mon, 14 Aug 2017 12:22:28 +0000 (13:22 +0100)] 
Add local argparse for compat with python 2.6

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoRename 'rfb' to 'qnum'
Daniel P. Berrange [Thu, 10 Aug 2017 10:17:12 +0000 (11:17 +0100)] 
Rename 'rfb' to 'qnum'

The 'rfb' keymap is not actually defined by the RFB protocol.
It is the QEMU key number mapping, that happens to be used
by a QEMU RFB extension.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAllow customizing the map length data type
Daniel P. Berrange [Thu, 10 Aug 2017 10:11:56 +0000 (11:11 +0100)] 
Allow customizing the map length data type

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoFix USB menu key mapping
Daniel P. Berrange [Tue, 8 Aug 2017 16:56:20 +0000 (17:56 +0100)] 
Fix USB menu key mapping

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoRemove ??? from some keynames
Daniel P. Berrange [Tue, 8 Aug 2017 16:56:07 +0000 (17:56 +0100)] 
Remove ??? from some keynames

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoFix ANSI_KeypadClear mapping for OSX
Daniel P. Berrange [Tue, 8 Aug 2017 16:53:43 +0000 (17:53 +0100)] 
Fix ANSI_KeypadClear mapping for OSX

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoHandle maps where 0x0 is a valid key
Daniel P. Berrange [Tue, 8 Aug 2017 12:06:49 +0000 (13:06 +0100)] 
Handle maps where 0x0 is a valid key

With OS-X / ADB keycodes 0x0 refers to key 'A', so cannot be
used as the default in the array. We must use 0xff instead and
thus explicitly fill every array entry with 0xff if no mapping
is available.

To handle this for enum based source maps, we need to use the
magic syntax

   [0 .... max] = value,

to set the default value in all elements, and then override
it afterwards for mappings which are known.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd support for array upper bounds with enums
Daniel P. Berrange [Tue, 8 Aug 2017 12:11:45 +0000 (13:11 +0100)] 
Add support for array upper bounds with enums

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd missing Help key entry for OS-X key codes
Daniel P. Berrange [Tue, 8 Aug 2017 12:00:01 +0000 (13:00 +0100)] 
Add missing Help key entry for OS-X key codes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd many missing Sun scancodes
Daniel P. Berrange [Mon, 7 Aug 2017 17:15:00 +0000 (18:15 +0100)] 
Add many missing Sun scancodes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd Apple Desktop Bus scancodes
Daniel P. Berrange [Mon, 7 Aug 2017 17:07:24 +0000 (18:07 +0100)] 
Add Apple Desktop Bus scancodes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoMisc fixes in AT set 3 scancodes
Daniel P. Berrange [Mon, 7 Aug 2017 17:06:24 +0000 (18:06 +0100)] 
Misc fixes in AT set 3 scancodes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoFix AT set3 mapping for backslash
Daniel P. Berrange [Mon, 7 Aug 2017 16:10:31 +0000 (17:10 +0100)] 
Fix AT set3 mapping for backslash

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoFix AT Set2 scancode for F7
Daniel P. Berrange [Mon, 7 Aug 2017 15:53:35 +0000 (16:53 +0100)] 
Fix AT Set2 scancode for F7

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd line for QKeyCode print
Daniel P. Berrange [Mon, 7 Aug 2017 15:52:50 +0000 (16:52 +0100)] 
Add line for QKeyCode print

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd line for QKeyCode asterisk
Daniel P. Berrange [Mon, 7 Aug 2017 15:52:37 +0000 (16:52 +0100)] 
Add line for QKeyCode asterisk

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd some missing mappings for USB HID
Daniel P. Berrange [Mon, 7 Aug 2017 12:32:32 +0000 (13:32 +0100)] 
Add some missing mappings for USB HID

Some USB scan codes map to the same Linux key code, and we were
missing the first mapping.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd Sun/Sparc keyboard keycodes
Daniel P. Berrange [Mon, 7 Aug 2017 12:19:43 +0000 (13:19 +0100)] 
Add Sun/Sparc keyboard keycodes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoBuild tests with warnings enabled
Daniel P. Berrange [Mon, 7 Aug 2017 11:11:51 +0000 (12:11 +0100)] 
Build tests with warnings enabled

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd ability to generate enums
Daniel P. Berrange [Mon, 31 Jul 2017 10:47:39 +0000 (11:47 +0100)] 
Add ability to generate enums

While we know the integer values corresponding to most key sets, the
QEMU QKeyCode values are explicitly not-public, not guaranteed stable.
We must therefore be able to emit symbolic enum constants, instead of
raw int values.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoAdd named constants for QKeyCode values
Daniel P. Berrange [Mon, 7 Aug 2017 09:52:46 +0000 (10:52 +0100)] 
Add named constants for QKeyCode values

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoUse STL types for C++ output
Pierre Ossman [Mon, 17 Jul 2017 10:00:43 +0000 (12:00 +0200)] 
Use STL types for C++ output

This give us much nicer lookup for string keys, boundary checks
and better introspection when it comes to iteration.

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoProvide array size constant for C output
Pierre Ossman [Thu, 13 Jul 2017 14:04:41 +0000 (16:04 +0200)] 
Provide array size constant for C output

The array might not be in the same unit as the code using it, so
we need a way of indicating the number of entries.

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd support for JavaScript output
Pierre Ossman [Wed, 31 May 2017 14:02:36 +0000 (16:02 +0200)] 
Add support for JavaScript output

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoHandle string based codes
Pierre Ossman [Wed, 31 May 2017 13:51:59 +0000 (15:51 +0200)] 
Handle string based codes

Some systems use string identifiers rather than integers.

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoFix some keys on macOS
Pierre Ossman [Thu, 13 Jul 2017 14:02:35 +0000 (16:02 +0200)] 
Fix some keys on macOS

The right command key was missing and the menu key was mis-assigned.

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd mapping for XKEYBOARD key names
Pierre Ossman [Wed, 10 May 2017 14:55:28 +0000 (16:55 +0200)] 
Add mapping for XKEYBOARD key names

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd mapping for HTML key codes
Pierre Ossman [Tue, 9 May 2017 14:12:58 +0000 (16:12 +0200)] 
Add mapping for HTML key codes

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd tests for name-table
Pierre Ossman [Fri, 14 Jul 2017 12:22:43 +0000 (14:22 +0200)] 
Add tests for name-table

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd tests for name-map
Pierre Ossman [Fri, 14 Jul 2017 12:16:27 +0000 (14:16 +0200)] 
Add tests for name-map

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd tests for code-table
Pierre Ossman [Fri, 14 Jul 2017 12:10:38 +0000 (14:10 +0200)] 
Add tests for code-table

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd basic tests
Pierre Ossman [Fri, 14 Jul 2017 09:13:03 +0000 (11:13 +0200)] 
Add basic tests

Signed-off-by: Pierre Ossman <ossman@cendio.se>
4 years agoAdd README for data columns
Pierre Ossman [Mon, 8 May 2017 14:55:33 +0000 (16:55 +0200)] 
Add README for data columns

4 years agoRename X11 keycode header to keysym
Pierre Ossman [Mon, 8 May 2017 14:54:48 +0000 (16:54 +0200)] 
Rename X11 keycode header to keysym

keycode means something else in X11, so let's adjust this header to
avoid confusion.

4 years agoFix AT set 2 table
Pierre Ossman [Mon, 8 May 2017 13:35:37 +0000 (15:35 +0200)] 
Fix AT set 2 table

There were a lot of errors for the extended codes. Re-generate
the entries based on the mapping Linux uses.

4 years agoMerge XT columns
Pierre Ossman [Mon, 8 May 2017 11:26:13 +0000 (13:26 +0200)] 
Merge XT columns

XT, Linux RAW and and AT set 1 are all really the same thing so merge
them all together. Linux RAW uses a different encoding, but we can
compute that as needed.

4 years agoCorrect lookup of name in comment
Pierre Ossman [Mon, 8 May 2017 13:27:00 +0000 (15:27 +0200)] 
Correct lookup of name in comment

The maps are indexed by Linux keycode, not by the keycode type
corresponding to the names.

5 years agokeymap-gen: add support for generating output for C++ 2/head
Peter Korsgaard [Tue, 23 May 2017 07:58:16 +0000 (09:58 +0200)] 
keymap-gen: add support for generating output for C++

Designated initializers ([index] = value,) are not available in C++:

https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html

So add a custom stdc++ output format which outputs all array entries instead
of the "sparse" C variant.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
5 years agoFix message when seeing unknown map
Daniel P. Berrange [Wed, 26 Apr 2017 10:38:30 +0000 (11:38 +0100)] 
Fix message when seeing unknown map

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoFix incompatibility with older argparse
Daniel P. Berrange [Wed, 26 Apr 2017 10:34:15 +0000 (11:34 +0100)] 
Fix incompatibility with older argparse

With older argparse (circa 2.7.4 vintage), using set_defaults
to set a function on the main parser prevents it from ever
calling the functions set on the sub-parser.

We registered this default function so that we could get help
usage with argparse on python 3.x, since it doesn't print
error by default if no sub-parser command is given (but 2.x
does).

To workaround this, we instead check for 'func' attribute
existing on the parsed args. This is a no-op for python 2.x
since it already printed a usage message by default.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoMerge branch 'master' into 'master'
Pavel Grunt [Thu, 9 Mar 2017 10:47:51 +0000 (10:47 +0000)] 
Merge branch 'master' into 'master'

keymap-gen: Import sys

See merge request !1

5 years agokeymap-gen: Import sys 1/head
Pavel Grunt [Wed, 8 Mar 2017 13:22:11 +0000 (14:22 +0100)] 
keymap-gen: Import sys

It is used in usage()

5 years agoAdd ability to generate Perl POD docs for key map names & values
Daniel P. Berrange [Fri, 3 Mar 2017 12:21:24 +0000 (12:21 +0000)] 
Add ability to generate Perl POD docs for key map names & values

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoFix xorg kbd mapping generator
Daniel P. Berrange [Wed, 15 Feb 2017 18:45:05 +0000 (18:45 +0000)] 
Fix xorg kbd mapping generator

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoPrint help message if no sub-command is given
Daniel P. Berrange [Wed, 15 Feb 2017 18:14:26 +0000 (18:14 +0000)] 
Print help message if no sub-command is given

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoUse print_function in python 2
Daniel P. Berrange [Wed, 15 Feb 2017 18:13:51 +0000 (18:13 +0000)] 
Use print_function in python 2

To allow portability with py3 use the print_function. This
requires python >= 2.6.0

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoDon't call next() method in CSV reader
Daniel P. Berrange [Wed, 15 Feb 2017 18:13:06 +0000 (18:13 +0000)] 
Don't call next() method in CSV reader

The next() method was renamed in python3. Simply avoid calling
it to ensure portability

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoUse correct generator class for glib2
Daniel P. Berrange [Wed, 15 Feb 2017 14:57:24 +0000 (14:57 +0000)] 
Use correct generator class for glib2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoUse guint16 / unsigned short for C data types
Daniel P. Berrange [Wed, 15 Feb 2017 14:53:17 +0000 (14:53 +0000)] 
Use guint16 / unsigned short for C data types

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoAdd missing X11 map field
Daniel P. Berrange [Wed, 15 Feb 2017 14:35:41 +0000 (14:35 +0000)] 
Add missing X11 map field

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoInitial import of code
Daniel P. Berrange [Wed, 15 Feb 2017 14:19:28 +0000 (14:19 +0000)] 
Initial import of code

The data/keymaps.csv file is taken from the latest SPICE-GTK
repository. All contributions from this original file in both
SPICE-GTK and GTK-VNC repos were made under Red Hat copyright.
Red Hat grants permission to relicense to dual GPL2 or 3-clause
BSD.

The data/keymap-gen tool is a brand new file.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>