* [Qemu-devel] [PULL 1/7] ui: add next and prior keysyms
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 2/7] ui: move qemu_input_linux_to_qcode() Gerd Hoffmann
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-2-kraxel@redhat.com
---
ui/curses_keys.h | 2 ++
ui/vnc_keysym.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/ui/curses_keys.h b/ui/curses_keys.h
index e39ef9e718..e9195a1671 100644
--- a/ui/curses_keys.h
+++ b/ui/curses_keys.h
@@ -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 },
diff --git a/ui/vnc_keysym.h b/ui/vnc_keysym.h
index 7fa2bc1f1c..e8a2ec73c5 100644
--- a/ui/vnc_keysym.h
+++ b/ui/vnc_keysym.h
@@ -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 */
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 2/7] ui: move qemu_input_linux_to_qcode()
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 1/7] ui: add next and prior keysyms Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 3/7] ui: update keymaps Gerd Hoffmann
` (5 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Move from input-linux.c to input-keymap.c and export it,
so the function is available elsewhere too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-3-kraxel@redhat.com
---
include/ui/input.h | 1 +
ui/input-keymap.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
ui/input-linux.c | 113 ----------------------------------------------------
3 files changed, 116 insertions(+), 113 deletions(-)
diff --git a/include/ui/input.h b/include/ui/input.h
index 3cfd0f3363..c488585def 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -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);
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index 8a1476fc48..d4972bb364 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -3,6 +3,115 @@
#include "ui/keymaps.h"
#include "ui/input.h"
+#include "standard-headers/linux/input.h"
+
+static int linux_to_qcode[KEY_CNT] = {
+ [KEY_ESC] = Q_KEY_CODE_ESC,
+ [KEY_1] = Q_KEY_CODE_1,
+ [KEY_2] = Q_KEY_CODE_2,
+ [KEY_3] = Q_KEY_CODE_3,
+ [KEY_4] = Q_KEY_CODE_4,
+ [KEY_5] = Q_KEY_CODE_5,
+ [KEY_6] = Q_KEY_CODE_6,
+ [KEY_7] = Q_KEY_CODE_7,
+ [KEY_8] = Q_KEY_CODE_8,
+ [KEY_9] = Q_KEY_CODE_9,
+ [KEY_0] = Q_KEY_CODE_0,
+ [KEY_MINUS] = Q_KEY_CODE_MINUS,
+ [KEY_EQUAL] = Q_KEY_CODE_EQUAL,
+ [KEY_BACKSPACE] = Q_KEY_CODE_BACKSPACE,
+ [KEY_TAB] = Q_KEY_CODE_TAB,
+ [KEY_Q] = Q_KEY_CODE_Q,
+ [KEY_W] = Q_KEY_CODE_W,
+ [KEY_E] = Q_KEY_CODE_E,
+ [KEY_R] = Q_KEY_CODE_R,
+ [KEY_T] = Q_KEY_CODE_T,
+ [KEY_Y] = Q_KEY_CODE_Y,
+ [KEY_U] = Q_KEY_CODE_U,
+ [KEY_I] = Q_KEY_CODE_I,
+ [KEY_O] = Q_KEY_CODE_O,
+ [KEY_P] = Q_KEY_CODE_P,
+ [KEY_LEFTBRACE] = Q_KEY_CODE_BRACKET_LEFT,
+ [KEY_RIGHTBRACE] = Q_KEY_CODE_BRACKET_RIGHT,
+ [KEY_ENTER] = Q_KEY_CODE_RET,
+ [KEY_LEFTCTRL] = Q_KEY_CODE_CTRL,
+ [KEY_A] = Q_KEY_CODE_A,
+ [KEY_S] = Q_KEY_CODE_S,
+ [KEY_D] = Q_KEY_CODE_D,
+ [KEY_F] = Q_KEY_CODE_F,
+ [KEY_G] = Q_KEY_CODE_G,
+ [KEY_H] = Q_KEY_CODE_H,
+ [KEY_J] = Q_KEY_CODE_J,
+ [KEY_K] = Q_KEY_CODE_K,
+ [KEY_L] = Q_KEY_CODE_L,
+ [KEY_SEMICOLON] = Q_KEY_CODE_SEMICOLON,
+ [KEY_APOSTROPHE] = Q_KEY_CODE_APOSTROPHE,
+ [KEY_GRAVE] = Q_KEY_CODE_GRAVE_ACCENT,
+ [KEY_LEFTSHIFT] = Q_KEY_CODE_SHIFT,
+ [KEY_BACKSLASH] = Q_KEY_CODE_BACKSLASH,
+ [KEY_102ND] = Q_KEY_CODE_LESS,
+ [KEY_Z] = Q_KEY_CODE_Z,
+ [KEY_X] = Q_KEY_CODE_X,
+ [KEY_C] = Q_KEY_CODE_C,
+ [KEY_V] = Q_KEY_CODE_V,
+ [KEY_B] = Q_KEY_CODE_B,
+ [KEY_N] = Q_KEY_CODE_N,
+ [KEY_M] = Q_KEY_CODE_M,
+ [KEY_COMMA] = Q_KEY_CODE_COMMA,
+ [KEY_DOT] = Q_KEY_CODE_DOT,
+ [KEY_SLASH] = Q_KEY_CODE_SLASH,
+ [KEY_RIGHTSHIFT] = Q_KEY_CODE_SHIFT_R,
+ [KEY_LEFTALT] = Q_KEY_CODE_ALT,
+ [KEY_SPACE] = Q_KEY_CODE_SPC,
+ [KEY_CAPSLOCK] = Q_KEY_CODE_CAPS_LOCK,
+ [KEY_F1] = Q_KEY_CODE_F1,
+ [KEY_F2] = Q_KEY_CODE_F2,
+ [KEY_F3] = Q_KEY_CODE_F3,
+ [KEY_F4] = Q_KEY_CODE_F4,
+ [KEY_F5] = Q_KEY_CODE_F5,
+ [KEY_F6] = Q_KEY_CODE_F6,
+ [KEY_F7] = Q_KEY_CODE_F7,
+ [KEY_F8] = Q_KEY_CODE_F8,
+ [KEY_F9] = Q_KEY_CODE_F9,
+ [KEY_F10] = Q_KEY_CODE_F10,
+ [KEY_NUMLOCK] = Q_KEY_CODE_NUM_LOCK,
+ [KEY_SCROLLLOCK] = Q_KEY_CODE_SCROLL_LOCK,
+ [KEY_KP0] = Q_KEY_CODE_KP_0,
+ [KEY_KP1] = Q_KEY_CODE_KP_1,
+ [KEY_KP2] = Q_KEY_CODE_KP_2,
+ [KEY_KP3] = Q_KEY_CODE_KP_3,
+ [KEY_KP4] = Q_KEY_CODE_KP_4,
+ [KEY_KP5] = Q_KEY_CODE_KP_5,
+ [KEY_KP6] = Q_KEY_CODE_KP_6,
+ [KEY_KP7] = Q_KEY_CODE_KP_7,
+ [KEY_KP8] = Q_KEY_CODE_KP_8,
+ [KEY_KP9] = Q_KEY_CODE_KP_9,
+ [KEY_KPMINUS] = Q_KEY_CODE_KP_SUBTRACT,
+ [KEY_KPPLUS] = Q_KEY_CODE_KP_ADD,
+ [KEY_KPDOT] = Q_KEY_CODE_KP_DECIMAL,
+ [KEY_KPENTER] = Q_KEY_CODE_KP_ENTER,
+ [KEY_KPSLASH] = Q_KEY_CODE_KP_DIVIDE,
+ [KEY_KPASTERISK] = Q_KEY_CODE_KP_MULTIPLY,
+ [KEY_F11] = Q_KEY_CODE_F11,
+ [KEY_F12] = Q_KEY_CODE_F12,
+ [KEY_RIGHTCTRL] = Q_KEY_CODE_CTRL_R,
+ [KEY_SYSRQ] = Q_KEY_CODE_SYSRQ,
+ [KEY_RIGHTALT] = Q_KEY_CODE_ALT_R,
+ [KEY_HOME] = Q_KEY_CODE_HOME,
+ [KEY_UP] = Q_KEY_CODE_UP,
+ [KEY_PAGEUP] = Q_KEY_CODE_PGUP,
+ [KEY_LEFT] = Q_KEY_CODE_LEFT,
+ [KEY_RIGHT] = Q_KEY_CODE_RIGHT,
+ [KEY_END] = Q_KEY_CODE_END,
+ [KEY_DOWN] = Q_KEY_CODE_DOWN,
+ [KEY_PAGEDOWN] = Q_KEY_CODE_PGDN,
+ [KEY_INSERT] = Q_KEY_CODE_INSERT,
+ [KEY_DELETE] = Q_KEY_CODE_DELETE,
+ [KEY_LEFTMETA] = Q_KEY_CODE_META_L,
+ [KEY_RIGHTMETA] = Q_KEY_CODE_META_R,
+ [KEY_MENU] = Q_KEY_CODE_MENU,
+};
+
static const int qcode_to_number[] = {
[Q_KEY_CODE_SHIFT] = 0x2a,
[Q_KEY_CODE_SHIFT_R] = 0x36,
@@ -141,6 +250,12 @@ static const int qcode_to_number[] = {
static int number_to_qcode[0x100];
+int qemu_input_linux_to_qcode(unsigned int lnx)
+{
+ assert(lnx < KEY_CNT);
+ return linux_to_qcode[lnx];
+}
+
int qemu_input_key_value_to_number(const KeyValue *value)
{
if (value->type == KEY_VALUE_KIND_QCODE) {
diff --git a/ui/input-linux.c b/ui/input-linux.c
index 49d52a69cc..9720333b2c 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -16,119 +16,6 @@
#include <sys/ioctl.h>
#include "standard-headers/linux/input.h"
-static int linux_to_qcode[KEY_CNT] = {
- [KEY_ESC] = Q_KEY_CODE_ESC,
- [KEY_1] = Q_KEY_CODE_1,
- [KEY_2] = Q_KEY_CODE_2,
- [KEY_3] = Q_KEY_CODE_3,
- [KEY_4] = Q_KEY_CODE_4,
- [KEY_5] = Q_KEY_CODE_5,
- [KEY_6] = Q_KEY_CODE_6,
- [KEY_7] = Q_KEY_CODE_7,
- [KEY_8] = Q_KEY_CODE_8,
- [KEY_9] = Q_KEY_CODE_9,
- [KEY_0] = Q_KEY_CODE_0,
- [KEY_MINUS] = Q_KEY_CODE_MINUS,
- [KEY_EQUAL] = Q_KEY_CODE_EQUAL,
- [KEY_BACKSPACE] = Q_KEY_CODE_BACKSPACE,
- [KEY_TAB] = Q_KEY_CODE_TAB,
- [KEY_Q] = Q_KEY_CODE_Q,
- [KEY_W] = Q_KEY_CODE_W,
- [KEY_E] = Q_KEY_CODE_E,
- [KEY_R] = Q_KEY_CODE_R,
- [KEY_T] = Q_KEY_CODE_T,
- [KEY_Y] = Q_KEY_CODE_Y,
- [KEY_U] = Q_KEY_CODE_U,
- [KEY_I] = Q_KEY_CODE_I,
- [KEY_O] = Q_KEY_CODE_O,
- [KEY_P] = Q_KEY_CODE_P,
- [KEY_LEFTBRACE] = Q_KEY_CODE_BRACKET_LEFT,
- [KEY_RIGHTBRACE] = Q_KEY_CODE_BRACKET_RIGHT,
- [KEY_ENTER] = Q_KEY_CODE_RET,
- [KEY_LEFTCTRL] = Q_KEY_CODE_CTRL,
- [KEY_A] = Q_KEY_CODE_A,
- [KEY_S] = Q_KEY_CODE_S,
- [KEY_D] = Q_KEY_CODE_D,
- [KEY_F] = Q_KEY_CODE_F,
- [KEY_G] = Q_KEY_CODE_G,
- [KEY_H] = Q_KEY_CODE_H,
- [KEY_J] = Q_KEY_CODE_J,
- [KEY_K] = Q_KEY_CODE_K,
- [KEY_L] = Q_KEY_CODE_L,
- [KEY_SEMICOLON] = Q_KEY_CODE_SEMICOLON,
- [KEY_APOSTROPHE] = Q_KEY_CODE_APOSTROPHE,
- [KEY_GRAVE] = Q_KEY_CODE_GRAVE_ACCENT,
- [KEY_LEFTSHIFT] = Q_KEY_CODE_SHIFT,
- [KEY_BACKSLASH] = Q_KEY_CODE_BACKSLASH,
- [KEY_102ND] = Q_KEY_CODE_LESS,
- [KEY_Z] = Q_KEY_CODE_Z,
- [KEY_X] = Q_KEY_CODE_X,
- [KEY_C] = Q_KEY_CODE_C,
- [KEY_V] = Q_KEY_CODE_V,
- [KEY_B] = Q_KEY_CODE_B,
- [KEY_N] = Q_KEY_CODE_N,
- [KEY_M] = Q_KEY_CODE_M,
- [KEY_COMMA] = Q_KEY_CODE_COMMA,
- [KEY_DOT] = Q_KEY_CODE_DOT,
- [KEY_SLASH] = Q_KEY_CODE_SLASH,
- [KEY_RIGHTSHIFT] = Q_KEY_CODE_SHIFT_R,
- [KEY_LEFTALT] = Q_KEY_CODE_ALT,
- [KEY_SPACE] = Q_KEY_CODE_SPC,
- [KEY_CAPSLOCK] = Q_KEY_CODE_CAPS_LOCK,
- [KEY_F1] = Q_KEY_CODE_F1,
- [KEY_F2] = Q_KEY_CODE_F2,
- [KEY_F3] = Q_KEY_CODE_F3,
- [KEY_F4] = Q_KEY_CODE_F4,
- [KEY_F5] = Q_KEY_CODE_F5,
- [KEY_F6] = Q_KEY_CODE_F6,
- [KEY_F7] = Q_KEY_CODE_F7,
- [KEY_F8] = Q_KEY_CODE_F8,
- [KEY_F9] = Q_KEY_CODE_F9,
- [KEY_F10] = Q_KEY_CODE_F10,
- [KEY_NUMLOCK] = Q_KEY_CODE_NUM_LOCK,
- [KEY_SCROLLLOCK] = Q_KEY_CODE_SCROLL_LOCK,
- [KEY_KP0] = Q_KEY_CODE_KP_0,
- [KEY_KP1] = Q_KEY_CODE_KP_1,
- [KEY_KP2] = Q_KEY_CODE_KP_2,
- [KEY_KP3] = Q_KEY_CODE_KP_3,
- [KEY_KP4] = Q_KEY_CODE_KP_4,
- [KEY_KP5] = Q_KEY_CODE_KP_5,
- [KEY_KP6] = Q_KEY_CODE_KP_6,
- [KEY_KP7] = Q_KEY_CODE_KP_7,
- [KEY_KP8] = Q_KEY_CODE_KP_8,
- [KEY_KP9] = Q_KEY_CODE_KP_9,
- [KEY_KPMINUS] = Q_KEY_CODE_KP_SUBTRACT,
- [KEY_KPPLUS] = Q_KEY_CODE_KP_ADD,
- [KEY_KPDOT] = Q_KEY_CODE_KP_DECIMAL,
- [KEY_KPENTER] = Q_KEY_CODE_KP_ENTER,
- [KEY_KPSLASH] = Q_KEY_CODE_KP_DIVIDE,
- [KEY_KPASTERISK] = Q_KEY_CODE_KP_MULTIPLY,
- [KEY_F11] = Q_KEY_CODE_F11,
- [KEY_F12] = Q_KEY_CODE_F12,
- [KEY_RIGHTCTRL] = Q_KEY_CODE_CTRL_R,
- [KEY_SYSRQ] = Q_KEY_CODE_SYSRQ,
- [KEY_RIGHTALT] = Q_KEY_CODE_ALT_R,
- [KEY_HOME] = Q_KEY_CODE_HOME,
- [KEY_UP] = Q_KEY_CODE_UP,
- [KEY_PAGEUP] = Q_KEY_CODE_PGUP,
- [KEY_LEFT] = Q_KEY_CODE_LEFT,
- [KEY_RIGHT] = Q_KEY_CODE_RIGHT,
- [KEY_END] = Q_KEY_CODE_END,
- [KEY_DOWN] = Q_KEY_CODE_DOWN,
- [KEY_PAGEDOWN] = Q_KEY_CODE_PGDN,
- [KEY_INSERT] = Q_KEY_CODE_INSERT,
- [KEY_DELETE] = Q_KEY_CODE_DELETE,
- [KEY_LEFTMETA] = Q_KEY_CODE_META_L,
- [KEY_RIGHTMETA] = Q_KEY_CODE_META_R,
- [KEY_MENU] = Q_KEY_CODE_MENU,
-};
-
-static int qemu_input_linux_to_qcode(unsigned int lnx)
-{
- assert(lnx < KEY_CNT);
- return linux_to_qcode[lnx];
-}
-
static bool linux_is_button(unsigned int lnx)
{
if (lnx < 0x100) {
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 3/7] ui: update keymaps
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 1/7] ui: add next and prior keysyms Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 2/7] ui: move qemu_input_linux_to_qcode() Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 4/7] ui: add multimedia keys Gerd Hoffmann
` (4 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add recently added QKeyCodes to the keymaps.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-4-kraxel@redhat.com
---
ui/input-keymap.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index d4972bb364..7461e1edde 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -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,
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 4/7] ui: add multimedia keys
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
` (2 preceding siblings ...)
2017-07-27 14:00 ` [Qemu-devel] [PULL 3/7] ui: update keymaps Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 17:45 ` Daniel P. Berrange
2017-07-27 14:00 ` [Qemu-devel] [PULL 5/7] ps2: enable " Gerd Hoffmann
` (3 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Eric Blake, Markus Armbruster
Add multimedia keys to QKeyCodes and to the keymaps.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-5-kraxel@redhat.com
---
ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
qapi-schema.json | 28 +++++++++++++++++++++++++++-
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index 7461e1edde..ae781beae9 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -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,
};
diff --git a/qapi-schema.json b/qapi-schema.json
index 9c6c3e1a53..9cb15092a7 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -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:
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 4/7] ui: add multimedia keys
2017-07-27 14:00 ` [Qemu-devel] [PULL 4/7] ui: add multimedia keys Gerd Hoffmann
@ 2017-07-27 17:45 ` Daniel P. Berrange
2017-07-28 6:21 ` Gerd Hoffmann
0 siblings, 1 reply; 15+ messages in thread
From: Daniel P. Berrange @ 2017-07-27 17:45 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel, Markus Armbruster
On Thu, Jul 27, 2017 at 04:00:22PM +0200, Gerd Hoffmann wrote:
> Add multimedia keys to QKeyCodes and to the keymaps.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Message-id: 20170726152918.11995-5-kraxel@redhat.com
> ---
> ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> qapi-schema.json | 28 +++++++++++++++++++++++++++-
> 2 files changed, 71 insertions(+), 1 deletion(-)
>
> diff --git a/ui/input-keymap.c b/ui/input-keymap.c
> index 7461e1edde..ae781beae9 100644
> --- a/ui/input-keymap.c
> +++ b/ui/input-keymap.c
> @@ -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,
We already have a Q_KEY_CODE_STOP that I think is the correct mapping
for KEY_STOP, so this new Q_KEY_CODE_AC_STOP looks like a dupe.
> + [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,
Similarly we already have a Q_KEY_CODE_FIND that should map to
KEY_FIND, so this Q_KEY_CODE_AC_SEARCH is another dup AFAICT.
I'm curious what the 'AC_' prefix on all these is indicating ?
Do we actually need it ?
> +
> + [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,
Missing Q_KEY_CODE_MEDIASELECT entry - presumably it was supposed
to map to KEY_MEDIA
> };
>
> 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,
Again no MEDIASELECT entry
> +
> [Q_KEY_CODE__MAX] = 0,
> };
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 9c6c3e1a53..9cb15092a7 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -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:
> --
> 2.9.3
>
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 4/7] ui: add multimedia keys
2017-07-27 17:45 ` Daniel P. Berrange
@ 2017-07-28 6:21 ` Gerd Hoffmann
2017-07-28 8:28 ` Daniel P. Berrange
0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-28 6:21 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: qemu-devel, Markus Armbruster
On Thu, 2017-07-27 at 18:45 +0100, Daniel P. Berrange wrote:
> On Thu, Jul 27, 2017 at 04:00:22PM +0200, Gerd Hoffmann wrote:
> > Add multimedia keys to QKeyCodes and to the keymaps.
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > Reviewed-by: Eric Blake <eblake@redhat.com>
> > Message-id: 20170726152918.11995-5-kraxel@redhat.com
> > ---
> > ui/input-keymap.c | 44
> > ++++++++++++++++++++++++++++++++++++++++++++
> > qapi-schema.json | 28 +++++++++++++++++++++++++++-
> > 2 files changed, 71 insertions(+), 1 deletion(-)
> >
> > diff --git a/ui/input-keymap.c b/ui/input-keymap.c
> > index 7461e1edde..ae781beae9 100644
> > --- a/ui/input-keymap.c
> > +++ b/ui/input-keymap.c
> > @@ -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,
>
> We already have a Q_KEY_CODE_STOP that I think is the correct mapping
> for KEY_STOP, so this new Q_KEY_CODE_AC_STOP looks like a dupe.
Oops, missed that indeed.
> > + [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,
>
> Similarly we already have a Q_KEY_CODE_FIND that should map to
> KEY_FIND, so this Q_KEY_CODE_AC_SEARCH is another dup AFAICT.
Yes.
> I'm curious what the 'AC_' prefix on all these is indicating ?
> Do we actually need it ?
Seems to stand for "application control".
# grep " AC " include/standard-headers/linux/input-event-codes.h
* AC - Application Control
#define KEY_STOP 128 /* AC Stop */
#define KEY_PROPS 130 /* AC Properties */
#define KEY_UNDO 131 /* AC Undo */
[ ... ]
I think it is better to keep it, even if it is inconsistent because we
already have stop + find without prefix. Just dropping the ac_ prefix
will not work for some keys, ac_home for example.
> Missing Q_KEY_CODE_MEDIASELECT entry - presumably it was supposed
> to map to KEY_MEDIA
There is KEY_SELECT too, but not KEY_MEDIASELECT. Hmm.
cheers,
Gerd
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 4/7] ui: add multimedia keys
2017-07-28 6:21 ` Gerd Hoffmann
@ 2017-07-28 8:28 ` Daniel P. Berrange
2017-07-28 9:57 ` Gerd Hoffmann
0 siblings, 1 reply; 15+ messages in thread
From: Daniel P. Berrange @ 2017-07-28 8:28 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel, Markus Armbruster
On Fri, Jul 28, 2017 at 08:21:49AM +0200, Gerd Hoffmann wrote:
> On Thu, 2017-07-27 at 18:45 +0100, Daniel P. Berrange wrote:
> > On Thu, Jul 27, 2017 at 04:00:22PM +0200, Gerd Hoffmann wrote:
> > > Add multimedia keys to QKeyCodes and to the keymaps.
> > >
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > Reviewed-by: Eric Blake <eblake@redhat.com>
> > > Message-id: 20170726152918.11995-5-kraxel@redhat.com
> > > ---
> > > ui/input-keymap.c | 44
> > > ++++++++++++++++++++++++++++++++++++++++++++
> > > qapi-schema.json | 28 +++++++++++++++++++++++++++-
> > > 2 files changed, 71 insertions(+), 1 deletion(-)
> > >
> > I'm curious what the 'AC_' prefix on all these is indicating ?
> > Do we actually need it ?
>
> Seems to stand for "application control".
>
> # grep " AC " include/standard-headers/linux/input-event-codes.h
> * AC - Application Control
> #define KEY_STOP 128 /* AC Stop */
> #define KEY_PROPS 130 /* AC Properties */
> #define KEY_UNDO 131 /* AC Undo */
> [ ... ]
>
> I think it is better to keep it, even if it is inconsistent because we
> already have stop + find without prefix. Just dropping the ac_ prefix
> will not work for some keys, ac_home for example.
Ok
>
> > Missing Q_KEY_CODE_MEDIASELECT entry - presumably it was supposed
> > to map to KEY_MEDIA
>
> There is KEY_SELECT too, but not KEY_MEDIASELECT. Hmm.
I found a keyboard with a key labelled "Media" and when pressed
it generates Linux key 171 / AT set1 0xe0 0x01 which is KEY_CONFIG
and GNOME pops up the control panel when pressed !
Would be interested to know results of "showkey" and "showkey -s" for
any other keyboards with a key labelled "Media", since I don't entirely
trust this particular one to be representative of general usage.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 4/7] ui: add multimedia keys
2017-07-28 8:28 ` Daniel P. Berrange
@ 2017-07-28 9:57 ` Gerd Hoffmann
2017-07-28 10:01 ` Daniel P. Berrange
0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-28 9:57 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: qemu-devel, Markus Armbruster
Hi,
> > > Missing Q_KEY_CODE_MEDIASELECT entry - presumably it was supposed
> > > to map to KEY_MEDIA
> >
> > There is KEY_SELECT too, but not KEY_MEDIASELECT. Hmm.
>
> I found a keyboard with a key labelled "Media" and when pressed
> it generates Linux key 171 / AT set1 0xe0 0x01 which is KEY_CONFIG
> and GNOME pops up the control panel when pressed !
Oh joy!
I guess we should just leave that unmapped for 2.10 and sort it later
when switching to keycodemapdb ...
> Would be interested to know results of "showkey" and "showkey -s" for
> any other keyboards with a key labelled "Media", since I don't
> entirely
> trust this particular one to be representative of general usage.
I don't have any. Seems those multimedia keyboards with lots of extra
keys are out-of-fashion these days, with only a few keys (like volume)
still being in use.
cheers,
Gerd
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 4/7] ui: add multimedia keys
2017-07-28 9:57 ` Gerd Hoffmann
@ 2017-07-28 10:01 ` Daniel P. Berrange
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrange @ 2017-07-28 10:01 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel, Markus Armbruster
On Fri, Jul 28, 2017 at 11:57:09AM +0200, Gerd Hoffmann wrote:
> Hi,
>
> > > > Missing Q_KEY_CODE_MEDIASELECT entry - presumably it was supposed
> > > > to map to KEY_MEDIA
> > >
> > > There is KEY_SELECT too, but not KEY_MEDIASELECT. Hmm.
> >
> > I found a keyboard with a key labelled "Media" and when pressed
> > it generates Linux key 171 / AT set1 0xe0 0x01 which is KEY_CONFIG
> > and GNOME pops up the control panel when pressed !
>
> Oh joy!
>
> I guess we should just leave that unmapped for 2.10 and sort it later
> when switching to keycodemapdb ...
Ok, I found a reference
http://www.computer-engineering.org/ps2keyboard/scancodes1.html
Lists 'Media select' as generating 0xe0 0x6d, which corresponds
to KEY_MEDIA in Linux.
So that confirms my keyboard is simply incorrectly labelled or
wired up, as suspected.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 5/7] ps2: enable multimedia keys
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
` (3 preceding siblings ...)
2017-07-27 14:00 ` [Qemu-devel] [PULL 4/7] ui: add multimedia keys Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 6/7] ui: drop altgr and altgr_r QKeyCodes Gerd Hoffmann
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Fixes: 8c10e0baf0260b59a4e984744462a18016662e3e
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-6-kraxel@redhat.com
---
hw/input/ps2.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 3ba05efd06..25ae7fc852 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -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,
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 6/7] ui: drop altgr and altgr_r QKeyCodes
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
` (4 preceding siblings ...)
2017-07-27 14:00 ` [Qemu-devel] [PULL 5/7] ps2: enable " Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 14:00 ` [Qemu-devel] [PULL 7/7] ps2: fix sending of PAUSE/BREAK scancodes Gerd Hoffmann
2017-07-27 15:43 ` [Qemu-devel] [PULL 0/7] Ui 20170727 patches Peter Maydell
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Paolo Bonzini, Eric Blake, Markus Armbruster
The right alt key (alt_r aka KEY_RIGHTALT) is used for AltGr.
The altgr and altgr_r keys simply don't exist. Drop them.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170727104720.30061-1-kraxel@redhat.com
---
hw/char/escc.c | 1 -
hw/input/adb.c | 1 -
hw/input/ps2.c | 2 --
ui/input-keymap.c | 2 --
qapi-schema.json | 3 ++-
5 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 89ae9eb997..1aca564e33 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -722,7 +722,6 @@ static const uint8_t qcode_to_keycode[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_SHIFT_R] = 110,
[Q_KEY_CODE_ALT] = 19,
[Q_KEY_CODE_ALT_R] = 13,
- [Q_KEY_CODE_ALTGR] = 13,
[Q_KEY_CODE_CTRL] = 76,
[Q_KEY_CODE_CTRL_R] = 76,
[Q_KEY_CODE_ESC] = 29,
diff --git a/hw/input/adb.c b/hw/input/adb.c
index 43d3205472..fcca3a8eb9 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -201,7 +201,6 @@ int qcode_to_adb_keycode[] = {
[Q_KEY_CODE_SHIFT_R] = ADB_KEY_RIGHT_SHIFT,
[Q_KEY_CODE_ALT] = ADB_KEY_LEFT_OPTION,
[Q_KEY_CODE_ALT_R] = ADB_KEY_RIGHT_OPTION,
- [Q_KEY_CODE_ALTGR] = ADB_KEY_RIGHT_OPTION,
[Q_KEY_CODE_CTRL] = ADB_KEY_LEFT_CONTROL,
[Q_KEY_CODE_CTRL_R] = ADB_KEY_RIGHT_CONTROL,
[Q_KEY_CODE_META_L] = ADB_KEY_COMMAND,
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 25ae7fc852..9f057e46ea 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -387,8 +387,6 @@ static const uint16_t qcode_to_keycode_set2[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_AC_REFRESH] = 0xe020,
[Q_KEY_CODE_AC_BOOKMARKS] = 0xe018,
- [Q_KEY_CODE_ALTGR] = 0x08,
- [Q_KEY_CODE_ALTGR_R] = 0xe008,
[Q_KEY_CODE_ASTERISK] = 0x7c,
[Q_KEY_CODE_LESS] = 0x61,
[Q_KEY_CODE_SYSRQ] = 0x7f,
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index ae781beae9..f96adf4165 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -146,8 +146,6 @@ static const int qcode_to_number[] = {
[Q_KEY_CODE_ALT] = 0x38,
[Q_KEY_CODE_ALT_R] = 0xb8,
- [Q_KEY_CODE_ALTGR] = 0x64,
- [Q_KEY_CODE_ALTGR_R] = 0xe4,
[Q_KEY_CODE_CTRL] = 0x1d,
[Q_KEY_CODE_CTRL_R] = 0x9d,
diff --git a/qapi-schema.json b/qapi-schema.json
index 9cb15092a7..dcc12c83a9 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4863,13 +4863,14 @@
# @ac_stop: since 2.10
# @ac_refresh: since 2.10
# @ac_bookmarks: since 2.10
+# altgr, altgr_r: dropped in 2.10
#
# Since: 1.3.0
#
##
{ 'enum': 'QKeyCode',
'data': [ 'unmapped',
- 'shift', 'shift_r', 'alt', 'alt_r', 'altgr', 'altgr_r', 'ctrl',
+ 'shift', 'shift_r', 'alt', 'alt_r', 'ctrl',
'ctrl_r', 'menu', 'esc', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '0', 'minus', 'equal', 'backspace', 'tab', 'q', 'w', 'e',
'r', 't', 'y', 'u', 'i', 'o', 'p', 'bracket_left', 'bracket_right',
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 7/7] ps2: fix sending of PAUSE/BREAK scancodes
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
` (5 preceding siblings ...)
2017-07-27 14:00 ` [Qemu-devel] [PULL 6/7] ui: drop altgr and altgr_r QKeyCodes Gerd Hoffmann
@ 2017-07-27 14:00 ` Gerd Hoffmann
2017-07-27 14:02 ` Daniel P. Berrange
2017-07-27 15:43 ` [Qemu-devel] [PULL 0/7] Ui 20170727 patches Peter Maydell
7 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2017-07-27 14:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrange, Gerd Hoffmann
From: "Daniel P. Berrange" <berrange@redhat.com>
The processing of the scancodes for PAUSE/BREAK has been broken since
the conversion to qcodes in:
commit 8c10e0baf0260b59a4e984744462a18016662e3e
Author: Hervé Poussineau <hpoussin@reactos.org>
Date: Thu Sep 15 22:06:26 2016 +0200
ps2: use QEMU qcodes instead of scancodes
When using a VNC client, with the raw scancode extension, the client
will send a scancode of 0xc6 for both PAUSE and BREAK. There is mistakenly
no entry in the qcode_to_number table for this scancode, so
ps2_keyboard_event() just generates a log message and discards the
scancode
When using a SPICE client, it will also send 0xc6 for BREAK, but
will send 0xe1 0x1d 0x45 0xe1 0x9d 0xc5 for PAUSE. There is no
entry in the qcode_to_number table for the scancode 0xe1 because
it is a special XT keyboard prefix not mapping to any QKeyCode.
Again ps2_keyboard_event() just generates a log message and discards
the scancode. The following 0x1d, 0x45, 0x9d, 0xc5 scancodes get
handled correctly. Rather than trying to handle 3 byte sequences
of scancodes in the PS/2 driver, special case the SPICE input
code so that it captures the 3 byte pause sequence and turns it
into a Pause QKeyCode.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170727113243.23991-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/keymaps.h | 1 +
ui/input-keymap.c | 1 +
ui/spice-input.c | 20 ++++++++++++++++++++
3 files changed, 22 insertions(+)
diff --git a/ui/keymaps.h b/ui/keymaps.h
index 47d061343e..8757465529 100644
--- a/ui/keymaps.h
+++ b/ui/keymaps.h
@@ -59,6 +59,7 @@ typedef struct {
/* "grey" keys will usually need a 0xe0 prefix */
#define SCANCODE_GREY 0x80
#define SCANCODE_EMUL0 0xE0
+#define SCANCODE_EMUL1 0xE1
/* "up" flag */
#define SCANCODE_UP 0x80
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index f96adf4165..0d9ddde9c9 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -233,6 +233,7 @@ static const int qcode_to_number[] = {
[Q_KEY_CODE_KP_ENTER] = 0x9c,
[Q_KEY_CODE_KP_DECIMAL] = 0x53,
[Q_KEY_CODE_SYSRQ] = 0x54,
+ [Q_KEY_CODE_PAUSE] = 0xc6,
[Q_KEY_CODE_KP_0] = 0x52,
[Q_KEY_CODE_KP_1] = 0x4f,
diff --git a/ui/spice-input.c b/ui/spice-input.c
index 918580239d..cda9976469 100644
--- a/ui/spice-input.c
+++ b/ui/spice-input.c
@@ -32,6 +32,7 @@ typedef struct QemuSpiceKbd {
SpiceKbdInstance sin;
int ledstate;
bool emul0;
+ size_t pauseseq;
} QemuSpiceKbd;
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
@@ -64,6 +65,25 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode)
keycode |= SCANCODE_GREY;
}
+ if (scancode == SCANCODE_EMUL1) {
+ kbd->pauseseq++;
+ return;
+ } else if (kbd->pauseseq == 1) {
+ if (keycode == 0x1d) {
+ kbd->pauseseq++;
+ return;
+ } else {
+ kbd->pauseseq = 0;
+ }
+ } else if (kbd->pauseseq == 2) {
+ if (keycode == 0x45) {
+ qemu_input_event_send_key_qcode(NULL, Q_KEY_CODE_PAUSE, !up);
+ kbd->pauseseq = 0;
+ return;
+ }
+ kbd->pauseseq = 0;
+ }
+
qemu_input_event_send_key_number(NULL, keycode, !up);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 7/7] ps2: fix sending of PAUSE/BREAK scancodes
2017-07-27 14:00 ` [Qemu-devel] [PULL 7/7] ps2: fix sending of PAUSE/BREAK scancodes Gerd Hoffmann
@ 2017-07-27 14:02 ` Daniel P. Berrange
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrange @ 2017-07-27 14:02 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Thu, Jul 27, 2017 at 04:00:25PM +0200, Gerd Hoffmann wrote:
> From: "Daniel P. Berrange" <berrange@redhat.com>
>
> The processing of the scancodes for PAUSE/BREAK has been broken since
> the conversion to qcodes in:
>
> commit 8c10e0baf0260b59a4e984744462a18016662e3e
> Author: Hervé Poussineau <hpoussin@reactos.org>
> Date: Thu Sep 15 22:06:26 2016 +0200
>
> ps2: use QEMU qcodes instead of scancodes
>
> When using a VNC client, with the raw scancode extension, the client
> will send a scancode of 0xc6 for both PAUSE and BREAK. There is mistakenly
> no entry in the qcode_to_number table for this scancode, so
> ps2_keyboard_event() just generates a log message and discards the
> scancode
>
> When using a SPICE client, it will also send 0xc6 for BREAK, but
> will send 0xe1 0x1d 0x45 0xe1 0x9d 0xc5 for PAUSE. There is no
> entry in the qcode_to_number table for the scancode 0xe1 because
> it is a special XT keyboard prefix not mapping to any QKeyCode.
> Again ps2_keyboard_event() just generates a log message and discards
> the scancode. The following 0x1d, 0x45, 0x9d, 0xc5 scancodes get
> handled correctly. Rather than trying to handle 3 byte sequences
> of scancodes in the PS/2 driver, special case the SPICE input
> code so that it captures the 3 byte pause sequence and turns it
> into a Pause QKeyCode.
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> Message-id: 20170727113243.23991-1-berrange@redhat.com
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> ui/keymaps.h | 1 +
> ui/input-keymap.c | 1 +
> ui/spice-input.c | 20 ++++++++++++++++++++
> 3 files changed, 22 insertions(+)
>
> diff --git a/ui/keymaps.h b/ui/keymaps.h
> index 47d061343e..8757465529 100644
> --- a/ui/keymaps.h
> +++ b/ui/keymaps.h
> @@ -59,6 +59,7 @@ typedef struct {
> /* "grey" keys will usually need a 0xe0 prefix */
> #define SCANCODE_GREY 0x80
> #define SCANCODE_EMUL0 0xE0
> +#define SCANCODE_EMUL1 0xE1
> /* "up" flag */
> #define SCANCODE_UP 0x80
>
> diff --git a/ui/input-keymap.c b/ui/input-keymap.c
> index f96adf4165..0d9ddde9c9 100644
> --- a/ui/input-keymap.c
> +++ b/ui/input-keymap.c
> @@ -233,6 +233,7 @@ static const int qcode_to_number[] = {
> [Q_KEY_CODE_KP_ENTER] = 0x9c,
> [Q_KEY_CODE_KP_DECIMAL] = 0x53,
> [Q_KEY_CODE_SYSRQ] = 0x54,
> + [Q_KEY_CODE_PAUSE] = 0xc6,
>
> [Q_KEY_CODE_KP_0] = 0x52,
> [Q_KEY_CODE_KP_1] = 0x4f,
> diff --git a/ui/spice-input.c b/ui/spice-input.c
> index 918580239d..cda9976469 100644
> --- a/ui/spice-input.c
> +++ b/ui/spice-input.c
> @@ -32,6 +32,7 @@ typedef struct QemuSpiceKbd {
> SpiceKbdInstance sin;
> int ledstate;
> bool emul0;
> + size_t pauseseq;
> } QemuSpiceKbd;
>
> static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
> @@ -64,6 +65,25 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode)
> keycode |= SCANCODE_GREY;
> }
>
> + if (scancode == SCANCODE_EMUL1) {
> + kbd->pauseseq++;
> + return;
> + } else if (kbd->pauseseq == 1) {
> + if (keycode == 0x1d) {
> + kbd->pauseseq++;
> + return;
> + } else {
> + kbd->pauseseq = 0;
> + }
> + } else if (kbd->pauseseq == 2) {
> + if (keycode == 0x45) {
> + qemu_input_event_send_key_qcode(NULL, Q_KEY_CODE_PAUSE, !up);
> + kbd->pauseseq = 0;
> + return;
> + }
> + kbd->pauseseq = 0;
> + }
> +
> qemu_input_event_send_key_number(NULL, keycode, !up);
> }
Self-NACK.
This impl is unfortunately wrong because it sends two Q_KEY_CODE_PAUSE
events, because it mistakenly considered the make + break codes as
separate sequences.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] Ui 20170727 patches
2017-07-27 14:00 [Qemu-devel] [PULL 0/7] Ui 20170727 patches Gerd Hoffmann
` (6 preceding siblings ...)
2017-07-27 14:00 ` [Qemu-devel] [PULL 7/7] ps2: fix sending of PAUSE/BREAK scancodes Gerd Hoffmann
@ 2017-07-27 15:43 ` Peter Maydell
7 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2017-07-27 15:43 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 27 July 2017 at 15:00, Gerd Hoffmann <kraxel@redhat.com> wrote:
> The following changes since commit 522fd24ca030c27c591dafedd65c1dfd51e40450:
>
> Update version for v2.10.0-rc0 release (2017-07-25 17:13:09 +0100)
>
> are available in the git repository at:
>
> git://git.kraxel.org/qemu tags/ui-20170727-pull-request
>
> for you to fetch changes up to 7c388dbd0b2c54b3d836c23ea43e2cee38de66a4:
>
> ps2: fix sending of PAUSE/BREAK scancodes (2017-07-27 14:24:05 +0200)
>
> ----------------------------------------------------------------
> ui: keymap fixes for 2.10
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread