Hi
I tried to add JIS keyboard support to virtio-input-hid but ran
into a problem with keys that have the "Linux Name" KEY_ISO and
KEY_KATAKANAHIRAGANA. The problem appears to be that they have
the same "AT set1 keycode" 0x70. I worked around it by removing
KEY_ISO from keycodemapdb and got the keys working, but that
doesn't work for the rest of QEMU. Is it intended that the keys
have the same "AT set1 keycode"?
Patch attached (also includes support for some mouse buttons):
---
diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index e78faec0b1..2cac659469 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -139,6 +139,13 @@ static const unsigned int keymap_qcode[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_META_L] = KEY_LEFTMETA,
[Q_KEY_CODE_META_R] = KEY_RIGHTMETA,
[Q_KEY_CODE_MENU] = KEY_MENU,
+
+ [Q_KEY_CODE_MUHENKAN] = KEY_MUHENKAN,
+ [Q_KEY_CODE_HENKAN] = KEY_HENKAN,
+ [Q_KEY_CODE_KATAKANAHIRAGANA] = KEY_KATAKANAHIRAGANA,
+ [Q_KEY_CODE_COMPOSE] = KEY_COMPOSE,
+ [Q_KEY_CODE_RO] = KEY_RO,
+ [Q_KEY_CODE_YEN] = KEY_YEN,
};
static const unsigned int keymap_button[INPUT_BUTTON__MAX] = {
@@ -147,6 +154,8 @@ static const unsigned int
keymap_button[INPUT_BUTTON__MAX] = {
[INPUT_BUTTON_MIDDLE] = BTN_MIDDLE,
[INPUT_BUTTON_WHEEL_UP] = BTN_GEAR_UP,
[INPUT_BUTTON_WHEEL_DOWN] = BTN_GEAR_DOWN,
+ [INPUT_BUTTON_SIDE] = BTN_SIDE,
+ [INPUT_BUTTON_EXTRA] = BTN_EXTRA,
};
static const unsigned int axismap_rel[INPUT_AXIS__MAX] = {
diff --git a/qapi/ui.json b/qapi/ui.json
index 07b468f625..da4be505ac 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -775,7 +775,7 @@
'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
- 'ro', 'hiragana', 'henkan', 'yen',
+ 'ro', 'hiragana', 'muhenkan', 'henkan', 'katakanahiragana', 'yen',
'kp_comma', 'kp_equals', 'power', 'sleep', 'wake',
'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute',
'volumeup', 'volumedown', 'mediaselect',
Submodule ui/keycodemapdb contains modified content
diff --git a/ui/keycodemapdb/data/keymaps.csv b/ui/keycodemapdb/data/keymaps.csv
index 0ef2ec1..825ce47 100644
--- a/ui/keycodemapdb/data/keymaps.csv
+++ b/ui/keycodemapdb/data/keymaps.csv
@@ -154,9 +154,9 @@
KEY_KATAKANA,90,JIS_Kana,0x68,0x78,0x63,,146,VK_KANA,0x15,,,,,Lang3,KATA,,,
KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Hiragana,HIRA,hiragana,,
KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Lang4,HIRA,hiragana,,
KEY_HENKAN,92,,,0x79,0x64,0x86,138,,,,,,,Convert,HENK,henkan,,
-KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,,,
-KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,,,
-KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,,,
+KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,katakanahiragana,,
+KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,muhenkan,,
+KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,muhenkan,,
KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,KPSP,,,
KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,JPCM,,,
KEY_KPENTER,96,ANSI_KeypadEnter,0x4c,0xe01c,0xe05a,0x79,88,,,0x64,0x64,XK_KP_Enter,0xff8d,NumpadEnter,KPEN,kp_enter,0x5a,0x4c
@@ -246,7 +246,6 @@
KEY_STOPCD,166,,,0xe024,0xe03b,0x98,233,VK_MEDIA_STOP,0xb2,,,,,MediaStop,I174,au
KEY_RECORD,167,,,0xe031,,0x9e,,,,,,,,,I175,,,
KEY_REWIND,168,,,0xe018,,0x9f,,,,,,,,,I176,,,
KEY_PHONE,169,,,0x63,,,,,,,,,,,I177,,,
-KEY_ISO,170,ISO_Section,0xa,0x70,,,,,,,,,,,I178,,,
KEY_CONFIG,171,,,0xe001,,,,,,,,,,,I179,,,
KEY_HOMEPAGE,172,,,0xe032,0xe03a,0x97,,VK_BROWSER_HOME,0xac,,,,,BrowserHome,I180,ac_home,,
KEY_REFRESH,173,,,0xe067,0xe020,,250,VK_BROWSER_REFRESH,0xa8,,,,,BrowserRefresh,I181,ac_refresh,,
On Fri, Dec 15, 2017 at 03:51:19PM +0200, Miika S wrote: > Hi > > I tried to add JIS keyboard support to virtio-input-hid but ran > into a problem with keys that have the "Linux Name" KEY_ISO and > KEY_KATAKANAHIRAGANA. The problem appears to be that they have > the same "AT set1 keycode" 0x70. I worked around it by removing > KEY_ISO from keycodemapdb and got the keys working, but that > doesn't work for the rest of QEMU. Is it intended that the keys > have the same "AT set1 keycode"? It is probably a misake > @@ -246,7 +246,6 @@ > KEY_STOPCD,166,,,0xe024,0xe03b,0x98,233,VK_MEDIA_STOP,0xb2,,,,,MediaStop,I174,au > KEY_RECORD,167,,,0xe031,,0x9e,,,,,,,,,I175,,, > KEY_REWIND,168,,,0xe018,,0x9f,,,,,,,,,I176,,, > KEY_PHONE,169,,,0x63,,,,,,,,,,,I177,,, > -KEY_ISO,170,ISO_Section,0xa,0x70,,,,,,,,,,,I178,,, Instead of deleteing this line entirely, the right fix is probably to just blank out the 0x70 value here. 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 :|
Ok, I don't know if there is a separate place where to send patches for keycodemapdb but I will put it in this reply. I will send a new set of patches for the QEMU changes that were in the first mail (hopefully in a better format than this one) and also a fix for mouse wheel event being sent twice. ------------------------------------------------------------------------------ From 506f0bf52b9743e19a65be83be8adf4782edd21b Mon Sep 17 00:00:00 2001 From: Miika S <miika9764@gmail.com> Date: Fri, 15 Dec 2017 21:50:23 +0200 Subject: [PATCH 1/1] 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> --- data/keymaps.csv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/keymaps.csv b/data/keymaps.csv index 0ef2ec1..bc2376c 100644 --- a/data/keymaps.csv +++ b/data/keymaps.csv @@ -154,9 +154,9 @@ KEY_KATAKANA,90,JIS_Kana,0x68,0x78,0x63,,146,VK_KANA,0x15,,,,,Lang3,KATA,,, KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Hiragana,HIRA,hiragana,, KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Lang4,HIRA,hiragana,, KEY_HENKAN,92,,,0x79,0x64,0x86,138,,,,,,,Convert,HENK,henkan,, -KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,,, -KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,,, -KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,,, +KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,katakanahiragana,, +KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,muhenkan,, +KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,muhenkan,, KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,KPSP,,, KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,JPCM,,, KEY_KPENTER,96,ANSI_KeypadEnter,0x4c,0xe01c,0xe05a,0x79,88,,,0x64,0x64,XK_KP_Enter,0xff8d,NumpadEnter,KPEN,kp_enter,0x5a,0x4c @@ -246,7 +246,7 @@ KEY_STOPCD,166,,,0xe024,0xe03b,0x98,233,VK_MEDIA_STOP,0xb2,,,,,MediaStop,I174,au KEY_RECORD,167,,,0xe031,,0x9e,,,,,,,,,I175,,, KEY_REWIND,168,,,0xe018,,0x9f,,,,,,,,,I176,,, KEY_PHONE,169,,,0x63,,,,,,,,,,,I177,,, -KEY_ISO,170,ISO_Section,0xa,0x70,,,,,,,,,,,I178,,, +KEY_ISO,170,ISO_Section,0xa,,,,,,,,,,,,I178,,, KEY_CONFIG,171,,,0xe001,,,,,,,,,,,I179,,, KEY_HOMEPAGE,172,,,0xe032,0xe03a,0x97,,VK_BROWSER_HOME,0xac,,,,,BrowserHome,I180,ac_home,, KEY_REFRESH,173,,,0xe067,0xe020,,250,VK_BROWSER_REFRESH,0xa8,,,,,BrowserRefresh,I181,ac_refresh,, -- 2.15.1 On Fri, Dec 15, 2017 at 3:57 PM, Daniel P. Berrange <berrange@redhat.com> wrote: > On Fri, Dec 15, 2017 at 03:51:19PM +0200, Miika S wrote: >> Hi >> >> I tried to add JIS keyboard support to virtio-input-hid but ran >> into a problem with keys that have the "Linux Name" KEY_ISO and >> KEY_KATAKANAHIRAGANA. The problem appears to be that they have >> the same "AT set1 keycode" 0x70. I worked around it by removing >> KEY_ISO from keycodemapdb and got the keys working, but that >> doesn't work for the rest of QEMU. Is it intended that the keys >> have the same "AT set1 keycode"? > > It is probably a misake > > >> @@ -246,7 +246,6 @@ >> KEY_STOPCD,166,,,0xe024,0xe03b,0x98,233,VK_MEDIA_STOP,0xb2,,,,,MediaStop,I174,au >> KEY_RECORD,167,,,0xe031,,0x9e,,,,,,,,,I175,,, >> KEY_REWIND,168,,,0xe018,,0x9f,,,,,,,,,I176,,, >> KEY_PHONE,169,,,0x63,,,,,,,,,,,I177,,, >> -KEY_ISO,170,ISO_Section,0xa,0x70,,,,,,,,,,,I178,,, > > Instead of deleteing this line entirely, the right fix is probably to just > blank out the 0x70 value here. > > > 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 :|
On Fri, Dec 15, 2017 at 10:03:31PM +0200, Miika S wrote: > Ok, I don't know if there is a separate place where to send patches > for keycodemapdb but I will put it in this reply. I will send a new > set of patches for the QEMU changes that were in the first mail > (hopefully in a better format than this one) and also a fix for mouse > wheel event being sent twice. keycodemapdb patches can be sent as a pull request to the master upstream repo https://gitlab.com/keycodemap/keycodemapdb/merge_requests That said, I watch for patches sent to gtk-vnc/qemu/libvirt/spice-gtk lists that cover keycodemapdb, so I have applied your patch to the upstream. When sending your updated qemu patch, don't forget to include the keycodemapdb git submodule update to the hash containing your change 05dad417e9d0b37ee1fba33056d91a6b734b3357 You can do this as follows cd $YOUR-QEMU-CHECKOUT cd ui/keycodemapdb git pull cd ../.. git add ui/keycodemapdb 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 :|
© 2016 - 2024 Red Hat, Inc.