Skip to contentSkip to conversation

kbd: add brazil kbd keys to qemu

PATCH In review Gerd Hoffmann 4 participants 6 messages May 28, 2015

lore
Share & tools
lore
#1 lore raw

PATCH v2 2/2 kbd: add brazil kbd keys to x11 evdev map

In reply to Gerd Hoffmann

This patch adds the two extra brazilian keys to the evdev keymap for X11. This patch gets the two keys going with the vnc, gtk and sdl1 UIs.

The SDL2 library complains it doesn't know these keys, so the SDL2 library must be fixed before we can update ui/sdl2-keymap.h

---
 ui/x_keymap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ui/x_keymap.c +2 -2
index b9b0944..1a77317 100644
@@ -94,7 +94,7 @@ static const uint8_t x_keycode_to_pc_keycode[115] = {
  */
 
 static const uint8_t evdev_keycode_to_pc_keycode[61] = {
-    0,         /*  97 EVDEV - RO   ("Internet" Keyboards) */
+    0x73,      /*  97 EVDEV - RO   ("Internet" Keyboards) */
     0,         /*  98 EVDEV - KATA (Katakana) */
     0,         /*  99 EVDEV - HIRA (Hiragana) */
     0x79,      /* 100 EVDEV - HENK (Henkan) */
@@ -126,7 +126,7 @@ static const uint8_t evdev_keycode_to_pc_keycode[61] = {
     0,         /* 126 EVDEV - I126 ("Internet" Keyboards) */
     0,         /* 127 EVDEV - PAUS */
     0,         /* 128 EVDEV - ???? */
-    0,         /* 129 EVDEV - I129 ("Internet" Keyboards) */
+    0x7e,      /* 129 EVDEV - KP_COMMA (brazilian) */
     0xf1,      /* 130 EVDEV - HNGL (Korean Hangul Latin toggle) */
     0xf2,      /* 131 EVDEV - HJCV (Korean Hangul Hanja toggle) */
     0x7d,      /* 132 AE13 (Yen)*/
Signature · 1 line
1.8.3.1
#0 lore raw

PATCH v2 1/2 kbd: add brazil kbd keys to qemu

The brazilian computer keyboard layout has two extra keys (compared to the usual 105-key intl ps/2 keyboard). This patch makes these two keys known to qemu.

For historic reasons qemu has two ways to specify a key: A QKeyCode (name-based) or a number (ps/2 scancode based). Therefore we have to update multiple places to make new keys known to qemu:

(1) The QKeyCode definition in qapi-schema.json
(2) The QKeyCode <-> number mapping table in ui/input-keymap.c

This patch does just that. With this patch applied you can send those two keys to the guest using the send-key monitor command.

---
 qapi-schema.json  | 4 +++-
 ui/input-keymap.c | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)
qapi-schema.json +3 -1
index f97ffa1..25df463 100644
@@ -2784,6 +2784,7 @@
 # Since: 1.3.0
 #
 # 'unmapped' and 'pause' since 2.0
+# 'ro' and 'kp_comma' since 2.4
 ##
 { 'enum': 'QKeyCode',
   'data': [ 'unmapped',
@@ -2801,7 +2802,8 @@
             'kp_9', 'less', 'f11', 'f12', 'print', 'home', 'pgup', 'pgdn', 'end',
             'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
             'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
-             'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause' ] }
+            'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause', 'ro',
+            'kp_comma' ] }
 
 ##
 # @KeyValue
ui/input-keymap.c +4 -0
index 5d29935..7635cb0 100644
@@ -128,6 +128,10 @@ static const int qcode_to_number[] = {
 
     [Q_KEY_CODE_INSERT] = 0xd2,
     [Q_KEY_CODE_DELETE] = 0xd3,
+
+    [Q_KEY_CODE_RO] = 0x73,
+    [Q_KEY_CODE_KP_COMMA] = 0x7e,
+
     [Q_KEY_CODE_MAX] = 0,
 };
 
Signature · 1 line
1.8.3.1
Reviewed-by on v2 2/2
#2 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] kbd: add brazil kbd keys to x11 evdev map

In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

This patch adds the two extra brazilian keys to the evdev keymap for X11. This patch gets the two keys going with the vnc, gtk and sdl1 UIs.

The SDL2 library complains it doesn't know these keys, so the SDL2 library must be fixed before we can update ui/sdl2-keymap.h

Reviewed-by on v2 1/2
#5 lore raw
In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

The brazilian computer keyboard layout has two extra keys (compared to the usual 105-key intl ps/2 keyboard). This patch makes these two keys known to qemu.

For historic reasons qemu has two ways to specify a key: A QKeyCode (name-based) or a number (ps/2 scancode based). Therefore we have to update multiple places to make new keys known to qemu:

Quoted 7 lines

(1) The QKeyCode definition in qapi-schema.json
(2) The QKeyCode <-> number mapping table in ui/input-keymap.c

This patch does just that. With this patch applied you can send those two keys to the guest using the send-key monitor command.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
Reviewed-by on v2 2/2
#3 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] kbd: add brazil kbd keys to x11 evdev map

In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

This patch adds the two extra brazilian keys to the evdev keymap for X11. This patch gets the two keys going with the vnc, gtk and sdl1 UIs.

The SDL2 library complains it doesn't know these keys, so the SDL2 library must be fixed before we can update ui/sdl2-keymap.h

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
Reviewed-by on v2 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] kbd: add brazil kbd keys to x11 evdev map

In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann

This patch adds the two extra brazilian keys to the evdev keymap for X11. This patch gets the two keys going with the vnc, gtk and sdl1 UIs.

The SDL2 library complains it doesn't know these keys, so the SDL2 library must be fixed before we can update ui/sdl2-keymap.h

Just a small nitpick: maybe you can actually add the necessary line to sdl2-keymap.h too, but comment it out, so the knowlege we gained in this episode remains in there?

In either case, for both patches:

Thank you for your work!

/mjt