Skip to contentSkip to conversation

ui: keymap fixes for 2.10

PATCH In review Gerd Hoffmann 2 participants 7 messages Jul 26, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover ui: keymap fixes for 2.10

This series adds multimedia keys to QKeyCodes, allowing them to be supported (again) by the ps/2 keyboard emulation. It also fixes some minor keymap issues along the way.

v2: remove '*' wildcard from schema docs.

Gerd Hoffmann (5):
ui: add next and prior keysyms
ui: move qemu_input_linux_to_qcode()
ui: update keymaps
ui: add multimedia keys
ps2: enable multimedia keys

 include/ui/input.h |   1 +
 ui/curses_keys.h   |   2 +
 ui/vnc_keysym.h    |   2 +
 hw/input/ps2.c     |   4 --
 ui/input-keymap.c  | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/input-linux.c   | 113 ------------------------------------
 qapi-schema.json   |  28 ++++++++-
 7 files changed, 198 insertions(+), 118 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH v2 1/5 ui: add next and prior keysyms

Page-up and Page-down were renamed. Add the names to the keysym list so we can parse both old and new names. The keypad versions are already present in the vnc map.

---
 ui/curses_keys.h | 2 ++
 ui/vnc_keysym.h  | 2 ++
 2 files changed, 4 insertions(+)
ui/curses_keys.h +2 -0
index e39ef9e718..e9195a1671 100644
@@ -480,7 +480,9 @@ static const name2keysym_t name2keysym[] = {
     { "Left", KEY_LEFT },
     { "Up", KEY_UP },
     { "Down", KEY_DOWN },
+    { "Next", KEY_NPAGE },
     { "Page_Down", KEY_NPAGE },
+    { "Prior", KEY_PPAGE },
     { "Page_Up", KEY_PPAGE },
     { "Insert", KEY_IC },
     { "Delete", KEY_DC },
ui/vnc_keysym.h +2 -0
index 7fa2bc1f1c..e8a2ec73c5 100644
@@ -254,7 +254,9 @@ static const name2keysym_t name2keysym[]={
 {"Left", 0xff51},      /* XK_Left */
 {"Up", 0xff52},        /* XK_Up */
 {"Down", 0xff54},      /* XK_Down */
+{"Next", 0xff56},
 {"Page_Down", 0xff56}, /* XK_Page_Down */
+{"Prior", 0xff55},
 {"Page_Up", 0xff55},   /* XK_Page_Up */
 {"Insert", 0xff63},    /* XK_Insert */
 {"Delete", 0xffff},    /* XK_Delete */
Signature · 1 line
2.9.3
#2 lore raw

PATCH v2 2/5 ui: move qemu_input_linux_to_qcode()

In reply to Gerd Hoffmann

Move from input-linux.c to input-keymap.c and export it, so the function is available elsewhere too.

---
 include/ui/input.h |   1 +
 ui/input-keymap.c  | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/input-linux.c   | 113 ----------------------------------------------------
 3 files changed, 116 insertions(+), 113 deletions(-)
include/ui/input.h +1 -0
index 3cfd0f3363..c488585def 100644
@@ -48,6 +48,7 @@ int qemu_input_key_value_to_number(const KeyValue *value);
 int qemu_input_key_value_to_qcode(const KeyValue *value);
 int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,
                                      int *codes);
+int qemu_input_linux_to_qcode(unsigned int lnx);
 
 InputEvent *qemu_input_event_new_btn(InputButton btn, bool down);
 void qemu_input_queue_btn(QemuConsole *src, InputButton btn, bool down);
ui/input-keymap.c +115 -0

127 lines not on this page · raw message

ui/input-linux.c +0 -113

119 lines not on this page · raw message

Signature · 1 line
2.9.3
#3 lore raw

PATCH v2 3/5 ui: update keymaps

In reply to Gerd Hoffmann

Add recently added QKeyCodes to the keymaps.

---
 ui/input-keymap.c | 7 +++++++
 1 file changed, 7 insertions(+)
ui/input-keymap.c +7 -0
index d4972bb364..7461e1edde 100644
@@ -94,6 +94,9 @@ static int linux_to_qcode[KEY_CNT] = {
     [KEY_KPASTERISK]     = Q_KEY_CODE_KP_MULTIPLY,
     [KEY_F11]            = Q_KEY_CODE_F11,
     [KEY_F12]            = Q_KEY_CODE_F12,
+    [KEY_RO]             = Q_KEY_CODE_RO,
+    [KEY_HIRAGANA]       = Q_KEY_CODE_HIRAGANA,
+    [KEY_HENKAN]         = Q_KEY_CODE_HENKAN,
     [KEY_RIGHTCTRL]      = Q_KEY_CODE_CTRL_R,
     [KEY_SYSRQ]          = Q_KEY_CODE_SYSRQ,
     [KEY_RIGHTALT]       = Q_KEY_CODE_ALT_R,
@@ -107,6 +110,9 @@ static int linux_to_qcode[KEY_CNT] = {
     [KEY_PAGEDOWN]       = Q_KEY_CODE_PGDN,
     [KEY_INSERT]         = Q_KEY_CODE_INSERT,
     [KEY_DELETE]         = Q_KEY_CODE_DELETE,
+    [KEY_POWER]          = Q_KEY_CODE_POWER,
+    [KEY_KPCOMMA]        = Q_KEY_CODE_KP_COMMA,
+    [KEY_YEN]            = Q_KEY_CODE_YEN,
     [KEY_LEFTMETA]       = Q_KEY_CODE_META_L,
     [KEY_RIGHTMETA]      = Q_KEY_CODE_META_R,
     [KEY_MENU]           = Q_KEY_CODE_MENU,
@@ -242,6 +248,7 @@ static const int qcode_to_number[] = {
     [Q_KEY_CODE_RO] = 0x73,
     [Q_KEY_CODE_HIRAGANA] = 0x70,
     [Q_KEY_CODE_HENKAN] = 0x79,
+    [Q_KEY_CODE_POWER] = 0xde,
     [Q_KEY_CODE_YEN] = 0x7d,
     [Q_KEY_CODE_KP_COMMA] = 0x7e,
 
Signature · 1 line
2.9.3
#4 lore raw

PATCH v2 4/5 ui: add multimedia keys

In reply to Gerd Hoffmann

Add multimedia keys to QKeyCodes and to the keymaps.

---
 ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 qapi-schema.json  | 28 +++++++++++++++++++++++++++-
 2 files changed, 71 insertions(+), 1 deletion(-)
ui/input-keymap.c +44 -0
index 7461e1edde..ae781beae9 100644
@@ -116,6 +116,28 @@ static int linux_to_qcode[KEY_CNT] = {
     [KEY_LEFTMETA]       = Q_KEY_CODE_META_L,
     [KEY_RIGHTMETA]      = Q_KEY_CODE_META_R,
     [KEY_MENU]           = Q_KEY_CODE_MENU,
+
+    [KEY_SLEEP]          = Q_KEY_CODE_SLEEP,
+    [KEY_WAKEUP]         = Q_KEY_CODE_WAKE,
+    [KEY_CALC]           = Q_KEY_CODE_CALCULATOR,
+    [KEY_MAIL]           = Q_KEY_CODE_MAIL,
+    [KEY_COMPUTER]       = Q_KEY_CODE_COMPUTER,
+
+    [KEY_STOP]           = Q_KEY_CODE_AC_STOP,
+    [KEY_BOOKMARKS]      = Q_KEY_CODE_AC_BOOKMARKS,
+    [KEY_BACK]           = Q_KEY_CODE_AC_BACK,
+    [KEY_FORWARD]        = Q_KEY_CODE_AC_FORWARD,
+    [KEY_HOMEPAGE]       = Q_KEY_CODE_AC_HOME,
+    [KEY_REFRESH]        = Q_KEY_CODE_AC_REFRESH,
+    [KEY_FIND]           = Q_KEY_CODE_AC_SEARCH,
+
+    [KEY_NEXTSONG]       = Q_KEY_CODE_AUDIONEXT,
+    [KEY_PREVIOUSSONG]   = Q_KEY_CODE_AUDIOPREV,
+    [KEY_STOPCD]         = Q_KEY_CODE_AUDIOSTOP,
+    [KEY_PLAYCD]         = Q_KEY_CODE_AUDIOPLAY,
+    [KEY_MUTE]           = Q_KEY_CODE_AUDIOMUTE,
+    [KEY_VOLUMEDOWN]     = Q_KEY_CODE_VOLUMEDOWN,
+    [KEY_VOLUMEUP]       = Q_KEY_CODE_VOLUMEUP,
 };
 
 static const int qcode_to_number[] = {
@@ -252,6 +274,28 @@ static const int qcode_to_number[] = {
     [Q_KEY_CODE_YEN] = 0x7d,
     [Q_KEY_CODE_KP_COMMA] = 0x7e,
 
+    [Q_KEY_CODE_SLEEP] = 0xdf,
+    [Q_KEY_CODE_WAKE] = 0xe3,
+    [Q_KEY_CODE_CALCULATOR] = 0xa1,
+    [Q_KEY_CODE_MAIL] = 0xec,
+    [Q_KEY_CODE_COMPUTER] = 0xeb,
+
+    [Q_KEY_CODE_AC_STOP] = 0xe8,
+    [Q_KEY_CODE_AC_BOOKMARKS] = 0xe6,
+    [Q_KEY_CODE_AC_BACK] = 0xea,
+    [Q_KEY_CODE_AC_FORWARD] = 0xe9,
+    [Q_KEY_CODE_AC_HOME] = 0xb2,
+    [Q_KEY_CODE_AC_REFRESH] = 0xe7,
+    [Q_KEY_CODE_AC_SEARCH] = 0xe5,
+
+    [Q_KEY_CODE_AUDIONEXT] = 0x99,
+    [Q_KEY_CODE_AUDIOPREV] = 0x90,
+    [Q_KEY_CODE_AUDIOSTOP] = 0xa4,
+    [Q_KEY_CODE_AUDIOPLAY] = 0xa2,
+    [Q_KEY_CODE_AUDIOMUTE] = 0xa0,
+    [Q_KEY_CODE_VOLUMEDOWN] = 0xae,
+    [Q_KEY_CODE_VOLUMEUP] = 0xb0,
+
     [Q_KEY_CODE__MAX] = 0,
 };
 
qapi-schema.json +27 -1
index 9c6c3e1a53..9cb15092a7 100644
@@ -4843,6 +4843,27 @@
 # @henkan: since 2.9
 # @yen: since 2.9
 #
+# @sleep: since 2.10
+# @wake: since 2.10
+# @audionext: since 2.10
+# @audioprev: since 2.10
+# @audiostop: since 2.10
+# @audioplay: since 2.10
+# @audiomute: since 2.10
+# @volumeup: since 2.10
+# @volumedown: since 2.10
+# @mediaselect: since 2.10
+# @mail: since 2.10
+# @calculator: since 2.10
+# @computer: since 2.10
+# @ac_search: since 2.10
+# @ac_home: since 2.10
+# @ac_back: since 2.10
+# @ac_forward: since 2.10
+# @ac_stop: since 2.10
+# @ac_refresh: since 2.10
+# @ac_bookmarks: since 2.10
+#
 # Since: 1.3.0
 #
 ##
@@ -4864,7 +4885,12 @@
             'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
             'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
             'ro', 'hiragana', 'henkan', 'yen',
-            'kp_comma', 'kp_equals', 'power' ] }
+            'kp_comma', 'kp_equals', 'power', 'sleep', 'wake',
+            'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute',
+            'volumeup', 'volumedown', 'mediaselect',
+            'mail', 'calculator', 'computer',
+            'ac_search', 'ac_home', 'ac_back', 'ac_forward', 'ac_stop',
+            'ac_refresh', 'ac_bookmarks' ] }
 
 ##
 # @KeyValue:
Signature · 1 line
2.9.3
Reviewed-by on v2 4/5
#5 lore raw

Re: [Qemu-devel] [PATCH v2 4/5] ui: add multimedia keys

Quoted 8 lines · Gerd Hoffmann

Add multimedia keys to QKeyCodes and to the keymaps.

---
 ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 qapi-schema.json  | 28 +++++++++++++++++++++++++++-
 2 files changed, 71 insertions(+), 1 deletion(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#6 lore raw

PATCH v2 5/5 ps2: enable multimedia keys

In reply to Gerd Hoffmann
Fixes 8c10e0baf0260b59a4e984744462a18016662e3e
---
 hw/input/ps2.c | 4 ----
 1 file changed, 4 deletions(-)
hw/input/ps2.c +0 -4
index 3ba05efd06..25ae7fc852 100644
@@ -224,7 +224,6 @@ static const uint16_t qcode_to_keycode_set1[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_DOT] = 0x34,
     [Q_KEY_CODE_SLASH] = 0x35,
 
-#if 0
     [Q_KEY_CODE_POWER] = 0x0e5e,
     [Q_KEY_CODE_SLEEP] = 0x0e5f,
     [Q_KEY_CODE_WAKE] = 0x0e63,
@@ -247,7 +246,6 @@ static const uint16_t qcode_to_keycode_set1[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_AC_STOP] = 0xe068,
     [Q_KEY_CODE_AC_REFRESH] = 0xe067,
     [Q_KEY_CODE_AC_BOOKMARKS] = 0xe066,
-#endif
 
     [Q_KEY_CODE_ASTERISK] = 0x37,
     [Q_KEY_CODE_LESS] = 0x56,
@@ -366,7 +364,6 @@ static const uint16_t qcode_to_keycode_set2[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_DOT] = 0x49,
     [Q_KEY_CODE_SLASH] = 0x4a,
 
-#if 0
     [Q_KEY_CODE_POWER] = 0x0e37,
     [Q_KEY_CODE_SLEEP] = 0x0e3f,
     [Q_KEY_CODE_WAKE] = 0x0e5e,
@@ -389,7 +386,6 @@ static const uint16_t qcode_to_keycode_set2[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_AC_STOP] = 0xe028,
     [Q_KEY_CODE_AC_REFRESH] = 0xe020,
     [Q_KEY_CODE_AC_BOOKMARKS] = 0xe018,
-#endif
 
     [Q_KEY_CODE_ALTGR] = 0x08,
     [Q_KEY_CODE_ALTGR_R] = 0xe008,
Signature · 1 line
2.9.3