diff mbox

[for-2.5,2/2] input: Promote 'input-send-event' to stable API

Message ID 1447279028-2114-3-git-send-email-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake Nov. 11, 2015, 9:57 p.m. UTC
We've had 'x-input-send-event' since 2.3, with no further
changes to the interface other than tweaks in the previous patch
to the spelling of the enum constants ('X' and 'WheelUp' changed
to 'x' and 'wheel-up').

What's more, changing the spelling of enum constants is not easy
to introspect prior to 2.5; so a client that was relying on the
experimental command can't easily tell which spelling is expected.
But 'query-commands' works in all qemu versions that supported
the command, so renaming the command now makes it an easy thing
to determine which spelling of the enum values to use.

Thus, it's time to promote this interface to stable.

CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 qapi-schema.json |  8 +++-----
 qmp-commands.hx  | 16 +++++++---------
 ui/input.c       |  4 ++--
 3 files changed, 12 insertions(+), 16 deletions(-)

Comments

Markus Armbruster Nov. 12, 2015, 8:23 a.m. UTC | #1
Eric Blake <eblake@redhat.com> writes:

> We've had 'x-input-send-event' since 2.3, with no further
> changes to the interface other than tweaks in the previous patch
> to the spelling of the enum constants ('X' and 'WheelUp' changed
> to 'x' and 'wheel-up').
>
> What's more, changing the spelling of enum constants is not easy
> to introspect prior to 2.5; so a client that was relying on the
> experimental command can't easily tell which spelling is expected.
> But 'query-commands' works in all qemu versions that supported
> the command, so renaming the command now makes it an easy thing
> to determine which spelling of the enum values to use.
>
> Thus, it's time to promote this interface to stable.

The x- goes back to commit df5b2ad:

    input: move input-send-event into experimental namespace
    
    Ongoing discussions on how we are going to specify the console,
    so tag the command as experiental so we can refine things in
    the 2.3 development cycle.
    
Have we settled "how we are going to specify the console"?  If yes,
commit, please.  If no, I'm afraid the command should stay experimental.
Gerd Hoffmann Nov. 12, 2015, 9:09 a.m. UTC | #2
On Do, 2015-11-12 at 09:23 +0100, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
> > We've had 'x-input-send-event' since 2.3, with no further
> > changes to the interface other than tweaks in the previous patch
> > to the spelling of the enum constants ('X' and 'WheelUp' changed
> > to 'x' and 'wheel-up').
> >
> > What's more, changing the spelling of enum constants is not easy
> > to introspect prior to 2.5; so a client that was relying on the
> > experimental command can't easily tell which spelling is expected.
> > But 'query-commands' works in all qemu versions that supported
> > the command, so renaming the command now makes it an easy thing
> > to determine which spelling of the enum values to use.
> >
> > Thus, it's time to promote this interface to stable.
> 
> The x- goes back to commit df5b2ad:
> 
>     input: move input-send-event into experimental namespace
>     
>     Ongoing discussions on how we are going to specify the console,
>     so tag the command as experiental so we can refine things in
>     the 2.3 development cycle.
>     
> Have we settled "how we are going to specify the console"?  If yes,
> commit, please.  If no, I'm afraid the command should stay experimental.

Good question.  I don't think so.

IIRC the question was whenever we'll leave it as-is (console=<index>),
or whenever we'll do something like display=<id>,head=<nr> instead.

The latter would be consistent with how we are doing input routing, i.e.
grouping display and input devices to a seat for multiseat setups (see
docs/multiseat.txt for more details).

The consoles are already present in the qom tree
as /backend/console[<index>] nodes, and they have device + head
children.  So qom users can map console=<index> to
display=<id>,head=<nr> and visa versa already.  So from a functionality
point of view it doesn't really matter, it is largely a matter of
taste ...

cheers,
  Gerd
Markus Armbruster Nov. 12, 2015, 11:10 a.m. UTC | #3
Gerd Hoffmann <kraxel@redhat.com> writes:

> On Do, 2015-11-12 at 09:23 +0100, Markus Armbruster wrote:
>> Eric Blake <eblake@redhat.com> writes:
>> 
>> > We've had 'x-input-send-event' since 2.3, with no further
>> > changes to the interface other than tweaks in the previous patch
>> > to the spelling of the enum constants ('X' and 'WheelUp' changed
>> > to 'x' and 'wheel-up').
>> >
>> > What's more, changing the spelling of enum constants is not easy
>> > to introspect prior to 2.5; so a client that was relying on the
>> > experimental command can't easily tell which spelling is expected.
>> > But 'query-commands' works in all qemu versions that supported
>> > the command, so renaming the command now makes it an easy thing
>> > to determine which spelling of the enum values to use.
>> >
>> > Thus, it's time to promote this interface to stable.
>> 
>> The x- goes back to commit df5b2ad:
>> 
>>     input: move input-send-event into experimental namespace
>>     
>>     Ongoing discussions on how we are going to specify the console,
>>     so tag the command as experiental so we can refine things in
>>     the 2.3 development cycle.
>>     
>> Have we settled "how we are going to specify the console"?  If yes,
>> commit, please.  If no, I'm afraid the command should stay experimental.
>
> Good question.  I don't think so.
>
> IIRC the question was whenever we'll leave it as-is (console=<index>),
> or whenever we'll do something like display=<id>,head=<nr> instead.
>
> The latter would be consistent with how we are doing input routing, i.e.
> grouping display and input devices to a seat for multiseat setups (see
> docs/multiseat.txt for more details).
>
> The consoles are already present in the qom tree
> as /backend/console[<index>] nodes, and they have device + head
> children.  So qom users can map console=<index> to
> display=<id>,head=<nr> and visa versa already.  So from a functionality
> point of view it doesn't really matter, it is largely a matter of
> taste ...

The thread leading to the x-:
http://lists.nongnu.org/archive/html/qemu-devel/2014-11/msg03197.html

I'm not sure the console numbers were visible in QOM back then.

We also discussed use of qdev ID.

Let's keep the x- until we've figured this out.
diff mbox

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index ecefb17..f99d413 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3605,7 +3605,7 @@ 
               'abs'     : 'InputMoveEvent' } }

 ##
-# @x-input-send-event
+# @input-send-event
 #
 # Send input event(s) to guest.
 #
@@ -3627,12 +3627,10 @@ 
 #
 # Returns: Nothing on success.
 #
-# Since: 2.2
-#
-# Note: this command is experimental, and not a stable API.
+# Since: 2.5
 #
 ##
-{ 'command': 'x-input-send-event',
+{ 'command': 'input-send-event',
   'data': { '*console':'int', 'events': [ 'InputEvent' ] } }

 ##
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 8f25fe0..cde7505 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -4475,13 +4475,13 @@  Example:
 EQMP

     {
-        .name       = "x-input-send-event",
+        .name       = "input-send-event",
         .args_type  = "console:i?,events:q",
-        .mhandler.cmd_new = qmp_marshal_x_input_send_event,
+        .mhandler.cmd_new = qmp_marshal_input_send_event,
     },

 SQMP
-@x-input-send-event
+@input-send-event
 -----------------

 Send input event to guest.
@@ -4495,19 +4495,17 @@  The consoles are visible in the qom tree, under
 /backend/console[$index]. They have a device link and head property, so
 it is possible to map which console belongs to which device and display.

-Note: this command is experimental, and not a stable API.
-
 Example (1):

 Press left mouse button.

--> { "execute": "x-input-send-event",
+-> { "execute": "input-send-event",
     "arguments": { "console": 0,
                    "events": [ { "type": "btn",
                     "data" : { "down": true, "button": "left" } } ] } }
 <- { "return": {} }

--> { "execute": "x-input-send-event",
+-> { "execute": "input-send-event",
     "arguments": { "console": 0,
                    "events": [ { "type": "btn",
                     "data" : { "down": false, "button": "left" } } ] } }
@@ -4517,7 +4515,7 @@  Example (2):

 Press ctrl-alt-del.

--> { "execute": "x-input-send-event",
+-> { "execute": "input-send-event",
      "arguments": { "console": 0, "events": [
         { "type": "key", "data" : { "down": true,
           "key": {"type": "qcode", "data": "ctrl" } } },
@@ -4531,7 +4529,7 @@  Example (3):

 Move mouse pointer to absolute coordinates (20000, 400).

--> { "execute": "x-input-send-event" ,
+-> { "execute": "input-send-event" ,
   "arguments": { "console": 0, "events": [
                { "type": "abs", "data" : { "axis": "x", "value" : 20000 } },
                { "type": "abs", "data" : { "axis": "y", "value" : 400 } } ] } }
diff --git a/ui/input.c b/ui/input.c
index a0f9873..59560f0 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -125,8 +125,8 @@  qemu_input_find_handler(uint32_t mask, QemuConsole *con)
     return NULL;
 }

-void qmp_x_input_send_event(bool has_console, 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;