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

Gerd Hoffmann posted 5 patches 8 years, 6 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Gerd Hoffmann 8 years, 6 months ago
Add multimedia keys to QKeyCodes and to the keymaps.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 qapi-schema.json  | 17 ++++++++++++++++-
 2 files changed, 60 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..93ff0f3921 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4843,6 +4843,16 @@
 # @henkan: since 2.9
 # @yen: since 2.9
 #
+# @sleep: since 2.10
+# @wake: since 2.10
+# @audio*: since 2.10
+# @volume*: since 2.10
+# @mediaselect: since 2.10
+# @mail: since 2.10
+# @calculator: since 2.10
+# @computer: since 2.10
+# @ac_*: since 2.10
+#
 # Since: 1.3.0
 #
 ##
@@ -4864,7 +4874,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


Re: [Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Eric Blake 8 years, 6 months ago
On 07/26/2017 06:56 AM, Gerd Hoffmann wrote:
> Add multimedia keys to QKeyCodes and to the keymaps.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  qapi-schema.json  | 17 ++++++++++++++++-
>  2 files changed, 60 insertions(+), 1 deletion(-)

> +++ b/qapi-schema.json
> @@ -4843,6 +4843,16 @@
>  # @henkan: since 2.9
>  # @yen: since 2.9
>  #
> +# @sleep: since 2.10
> +# @wake: since 2.10
> +# @audio*: since 2.10
> +# @volume*: since 2.10
> +# @mediaselect: since 2.10
> +# @mail: since 2.10
> +# @calculator: since 2.10
> +# @computer: since 2.10
> +# @ac_*: since 2.10

Borderline between bug-fix and new feature (arguing that the bug is that
we don't represent all keys).  Does this need to be 2.11 instead?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Daniel P. Berrange 8 years, 6 months ago
On Wed, Jul 26, 2017 at 07:02:48AM -0500, Eric Blake wrote:
> On 07/26/2017 06:56 AM, Gerd Hoffmann wrote:
> > Add multimedia keys to QKeyCodes and to the keymaps.
> > 
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> >  ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> >  qapi-schema.json  | 17 ++++++++++++++++-
> >  2 files changed, 60 insertions(+), 1 deletion(-)
> 
> > +++ b/qapi-schema.json
> > @@ -4843,6 +4843,16 @@
> >  # @henkan: since 2.9
> >  # @yen: since 2.9
> >  #
> > +# @sleep: since 2.10
> > +# @wake: since 2.10
> > +# @audio*: since 2.10
> > +# @volume*: since 2.10
> > +# @mediaselect: since 2.10
> > +# @mail: since 2.10
> > +# @calculator: since 2.10
> > +# @computer: since 2.10
> > +# @ac_*: since 2.10
> 
> Borderline between bug-fix and new feature (arguing that the bug is that
> we don't represent all keys).  Does this need to be 2.11 instead?

It is really fixing a bug introduced in the PS2 driver in 2.8.0.  It
roundtrips via QKeyCode now, so any key where there is an AT Set 1
scancode defined, but for which we lack a QKeyCode can't be sent to
guests since QEMU 2.8.0 onwards.

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 :|

Re: [Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Eric Blake 8 years, 6 months ago
On 07/26/2017 07:08 AM, Daniel P. Berrange wrote:
> On Wed, Jul 26, 2017 at 07:02:48AM -0500, Eric Blake wrote:
>> On 07/26/2017 06:56 AM, Gerd Hoffmann wrote:
>>> Add multimedia keys to QKeyCodes and to the keymaps.
>>>
>>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>>> ---
>>>  ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>>>  qapi-schema.json  | 17 ++++++++++++++++-
>>>  2 files changed, 60 insertions(+), 1 deletion(-)

>>> +# @ac_*: since 2.10
>>
>> Borderline between bug-fix and new feature (arguing that the bug is that
>> we don't represent all keys).  Does this need to be 2.11 instead?
> 
> It is really fixing a bug introduced in the PS2 driver in 2.8.0.  It
> roundtrips via QKeyCode now, so any key where there is an AT Set 1
> scancode defined, but for which we lack a QKeyCode can't be sent to
> guests since QEMU 2.8.0 onwards.

Sounds good to me, although that would be worth mentioning in the commit
message.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Gerd Hoffmann 8 years, 6 months ago
On Wed, 2017-07-26 at 07:12 -0500, Eric Blake wrote:
> On 07/26/2017 07:08 AM, Daniel P. Berrange wrote:
> > On Wed, Jul 26, 2017 at 07:02:48AM -0500, Eric Blake wrote:
> > > On 07/26/2017 06:56 AM, Gerd Hoffmann wrote:
> > > > Add multimedia keys to QKeyCodes and to the keymaps.
> > > > 
> > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > > ---
> > > >  ui/input-keymap.c | 44
> > > > ++++++++++++++++++++++++++++++++++++++++++++
> > > >  qapi-schema.json  | 17 ++++++++++++++++-
> > > >  2 files changed, 60 insertions(+), 1 deletion(-)
> > > > +# @ac_*: since 2.10
> > > 
> > > Borderline between bug-fix and new feature (arguing that the bug
> > > is that
> > > we don't represent all keys).  Does this need to be 2.11 instead?
> > 
> > It is really fixing a bug introduced in the PS2 driver in
> > 2.8.0.  It
> > roundtrips via QKeyCode now, so any key where there is an AT Set 1
> > scancode defined, but for which we lack a QKeyCode can't be sent to
> > guests since QEMU 2.8.0 onwards.
> 
> Sounds good to me, although that would be worth mentioning in the
> commit
> message.

5/5 is the actual fix, which has a Fixes: line.  It depends on this
patch.

cheers,
  Gerd


Re: [Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Eric Blake 8 years, 6 months ago
On 07/26/2017 06:56 AM, Gerd Hoffmann wrote:
> Add multimedia keys to QKeyCodes and to the keymaps.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/input-keymap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  qapi-schema.json  | 17 ++++++++++++++++-
>  2 files changed, 60 insertions(+), 1 deletion(-)

> +++ b/qapi-schema.json
> @@ -4843,6 +4843,16 @@
>  # @henkan: since 2.9
>  # @yen: since 2.9
>  #
> +# @sleep: since 2.10
> +# @wake: since 2.10
> +# @audio*: since 2.10
> +# @volume*: since 2.10
> +# @mediaselect: since 2.10
> +# @mail: since 2.10
> +# @calculator: since 2.10
> +# @computer: since 2.10
> +# @ac_*: since 2.10

I wondered if this would work, but didn't mention anything on the
assumption that it built for you.  But now that patchew is complaining
about a failed build, I suspect your attempt at abbreviation here is the
reason.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH 4/5] ui: add multimedia keys
Posted by Gerd Hoffmann 8 years, 6 months ago
> I wondered if this would work, but didn't mention anything on the
> assumption that it built for you.  But now that patchew is
> complaining
> about a failed build, I suspect your attempt at abbreviation here is
> the
> reason.

It worked for me, but only because it didn't build the docs.

Installing texinfo now ...

cheers,
  Gerd