qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent
@ 2014-11-07  4:41 Amos Kong
  2014-11-07  4:41 ` [Qemu-devel] [PATCH for-2.2 2/2] QMP/input-send-event: make console parameter optional Amos Kong
  2014-11-07  8:49 ` [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Eric Blake
  0 siblings, 2 replies; 6+ messages in thread
From: Amos Kong @ 2014-11-07  4:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: mtosatti, kraxel, armbru

Signed-off-by: Amos Kong <akong@redhat.com>
---
 qapi-schema.json | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qapi-schema.json b/qapi-schema.json
index 24379ab..a1573d8 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3231,6 +3231,11 @@
 #
 # Input event union.
 #
+# @key: Input event of Keyboard
+# @btn: Input event of pointer bottons
+# @rel: Input event of relative pointer motion
+# @abs: Input event of absolute pointer motion
+#
 # Since: 2.0
 ##
 { 'union' : 'InputEvent',
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH for-2.2 2/2] QMP/input-send-event: make console parameter optional
  2014-11-07  4:41 [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Amos Kong
@ 2014-11-07  4:41 ` Amos Kong
  2014-11-07  8:53   ` Eric Blake
  2014-11-07  8:49 ` [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Eric Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Amos Kong @ 2014-11-07  4:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: mtosatti, kraxel, armbru

The 'QemuConsole' is the input source for handler, we share some
input handlers to process the input events from different QemuConsole.

Normally we only have one set of keyboard, mouse, usbtablet, etc.
The devices have different mask, it's fine to just checking mask to
insure that the handler has the ability to process the event.

I saw we try to bind console to handler in usb/dev-hid.c, but display
always isn't available at that time.

If we have multiseat setup (as Gerd said), we only have 'problem' in
this case. Actually event from different devices have the same effect
for system, it's fine to always use the first available handler
without caring about the console.

For send-key command, we just pass a NULL for console parameter in
calling qemu_input_event_send_key(NULL, ..), but 'input-send-event'
needs to care more devices.

Conclusion:
Generally assigning the special console is meanless, and we can't
directly remove the QMP parameter for compatibility.

So we can make the parameter optional. The parameter might be useful
for some special condition: we have multiple devices without binding
console and they all have the ability(mask) to process events, and
we don't want to use the first one.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
---
 qapi-schema.json |  4 ++--
 qmp-commands.hx  |  4 ++--
 ui/input.c       | 15 +++++++++------
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index a1573d8..367fb8e 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3249,7 +3249,7 @@
 #
 # Send input event(s) to guest.
 #
-# @console: Which console to send event(s) to.
+# @console: #optional console to send event(s) to.
 #
 # @events: List of InputEvent union.
 #
@@ -3259,7 +3259,7 @@
 #
 ##
 { 'command': 'input-send-event',
-  'data': { 'console':'int', 'events': [ 'InputEvent' ] } }
+  'data': { '*console':'int', 'events': [ 'InputEvent' ] } }
 
 ##
 # @NumaOptions
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 1abd619..8812401 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3792,7 +3792,7 @@ EQMP
 
     {
         .name       = "input-send-event",
-        .args_type  = "console:i,events:q",
+        .args_type  = "console:i?,events:q",
         .mhandler.cmd_new = qmp_marshal_input_input_send_event,
     },
 
@@ -3804,7 +3804,7 @@ Send input event to guest.
 
 Arguments:
 
-- "console": console index.
+- "console": console index. (json-int, optional)
 - "events": list of input events.
 
 The consoles are visible in the qom tree, under
diff --git a/ui/input.c b/ui/input.c
index 002831e..37ff46f 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -122,16 +122,19 @@ qemu_input_find_handler(uint32_t mask, QemuConsole *con)
     return NULL;
 }
 
-void qmp_input_send_event(int64_t console, InputEventList *events,
-                          Error **errp)
+void qmp_input_send_event(bool has_console, int64_t console,
+                          InputEventList *events, Error **errp)
 {
     InputEventList *e;
     QemuConsole *con;
 
-    con = qemu_console_lookup_by_index(console);
-    if (!con) {
-        error_setg(errp, "console %" PRId64 " not found", console);
-        return;
+    con = NULL;
+    if (has_console) {
+        con = qemu_console_lookup_by_index(console);
+        if (!con) {
+            error_setg(errp, "console %" PRId64 " not found", console);
+            return;
+        }
     }
 
     if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent
  2014-11-07  4:41 [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Amos Kong
  2014-11-07  4:41 ` [Qemu-devel] [PATCH for-2.2 2/2] QMP/input-send-event: make console parameter optional Amos Kong
@ 2014-11-07  8:49 ` Eric Blake
  2014-11-07  8:50   ` Eric Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Blake @ 2014-11-07  8:49 UTC (permalink / raw)
  To: Amos Kong, qemu-devel; +Cc: mtosatti, kraxel, armbru

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

On 11/07/2014 05:41 AM, Amos Kong wrote:
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  qapi-schema.json | 5 +++++
>  1 file changed, 5 insertions(+)

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

> 
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 24379ab..a1573d8 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3231,6 +3231,11 @@
>  #
>  # Input event union.
>  #
> +# @key: Input event of Keyboard
> +# @btn: Input event of pointer bottons
> +# @rel: Input event of relative pointer motion
> +# @abs: Input event of absolute pointer motion
> +#
>  # Since: 2.0
>  ##
>  { 'union' : 'InputEvent',
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent
  2014-11-07  8:49 ` [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Eric Blake
@ 2014-11-07  8:50   ` Eric Blake
  2014-11-13 10:27     ` Gerd Hoffmann
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2014-11-07  8:50 UTC (permalink / raw)
  To: Amos Kong, qemu-devel; +Cc: mtosatti, kraxel, armbru

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On 11/07/2014 09:49 AM, Eric Blake wrote:
> On 11/07/2014 05:41 AM, Amos Kong wrote:
>> Signed-off-by: Amos Kong <akong@redhat.com>
>> ---
>>  qapi-schema.json | 5 +++++
>>  1 file changed, 5 insertions(+)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>

Shoot - I hit "send" too soon.

> 
>>
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index 24379ab..a1573d8 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -3231,6 +3231,11 @@
>>  #
>>  # Input event union.
>>  #
>> +# @key: Input event of Keyboard
>> +# @btn: Input event of pointer bottons

s/bottons/buttons/ before my R-b applies (maintainer could opt to do
this without needing a v2)

>> +# @rel: Input event of relative pointer motion
>> +# @abs: Input event of absolute pointer motion
>> +#
>>  # Since: 2.0
>>  ##
>>  { 'union' : 'InputEvent',
>>
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.2 2/2] QMP/input-send-event: make console parameter optional
  2014-11-07  4:41 ` [Qemu-devel] [PATCH for-2.2 2/2] QMP/input-send-event: make console parameter optional Amos Kong
@ 2014-11-07  8:53   ` Eric Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2014-11-07  8:53 UTC (permalink / raw)
  To: Amos Kong, qemu-devel; +Cc: mtosatti, kraxel, armbru

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]

On 11/07/2014 05:41 AM, Amos Kong wrote:
> The 'QemuConsole' is the input source for handler, we share some
> input handlers to process the input events from different QemuConsole.
> 
> Normally we only have one set of keyboard, mouse, usbtablet, etc.
> The devices have different mask, it's fine to just checking mask to
> insure that the handler has the ability to process the event.
> 
> I saw we try to bind console to handler in usb/dev-hid.c, but display
> always isn't available at that time.
> 
> If we have multiseat setup (as Gerd said), we only have 'problem' in
> this case. Actually event from different devices have the same effect
> for system, it's fine to always use the first available handler
> without caring about the console.
> 
> For send-key command, we just pass a NULL for console parameter in
> calling qemu_input_event_send_key(NULL, ..), but 'input-send-event'
> needs to care more devices.
> 
> Conclusion:
> Generally assigning the special console is meanless, and we can't

s/meanless/meaningless/

> directly remove the QMP parameter for compatibility.
> 
> So we can make the parameter optional. The parameter might be useful
> for some special condition: we have multiple devices without binding
> console and they all have the ability(mask) to process events, and
> we don't want to use the first one.
> 
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  qapi-schema.json |  4 ++--
>  qmp-commands.hx  |  4 ++--
>  ui/input.c       | 15 +++++++++------
>  3 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/qapi-schema.json b/qapi-schema.json
> index a1573d8..367fb8e 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3249,7 +3249,7 @@
>  #
>  # Send input event(s) to guest.
>  #
> -# @console: Which console to send event(s) to.
> +# @console: #optional console to send event(s) to.

Might be worth mentioning that the default is the first available
console.  The change is safe from back-compat perspective.

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

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent
  2014-11-07  8:50   ` Eric Blake
@ 2014-11-13 10:27     ` Gerd Hoffmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-11-13 10:27 UTC (permalink / raw)
  To: Eric Blake; +Cc: armbru, Amos Kong, qemu-devel, mtosatti

> >> +# @btn: Input event of pointer bottons
> 
> s/bottons/buttons/ before my R-b applies (maintainer could opt to do
> this without needing a v2)

Fixed up, queued, pull req sent.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-13 10:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07  4:41 [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Amos Kong
2014-11-07  4:41 ` [Qemu-devel] [PATCH for-2.2 2/2] QMP/input-send-event: make console parameter optional Amos Kong
2014-11-07  8:53   ` Eric Blake
2014-11-07  8:49 ` [Qemu-devel] [PATCH for-2.2 1/2] QMP/input-send-event: update document of union InputEvent Eric Blake
2014-11-07  8:50   ` Eric Blake
2014-11-13 10:27     ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).