diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-11-13 11:52:11 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-11-13 11:52:11 +0000 |
commit | e08d3004506e39cf25b3e1fa01f69bd1934d2846 (patch) | |
tree | 520c6b6ac0aad3a651c91661b82035003ae712f3 | |
parent | 410bd787bf44ef95192507802967a0edce19955f (diff) | |
parent | 51fc44768a5b71ad78fa40e609a58f71ed62775a (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20141113-1' into staging
QMP/input-send-event: make console parameter optional
# gpg: Signature made Thu 13 Nov 2014 10:07:26 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
* remotes/kraxel/tags/pull-input-20141113-1:
QMP/input-send-event: make console parameter optional
QMP/input-send-event: update document of union InputEvent
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | qapi-schema.json | 9 | ||||
-rw-r--r-- | qmp-commands.hx | 4 | ||||
-rw-r--r-- | ui/input.c | 15 |
3 files changed, 18 insertions, 10 deletions
diff --git a/qapi-schema.json b/qapi-schema.json index 24379ab3af..d0926d95f6 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 buttons +# @rel: Input event of relative pointer motion +# @abs: Input event of absolute pointer motion +# # Since: 2.0 ## { 'union' : 'InputEvent', @@ -3244,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. # @@ -3254,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 1abd61977b..8812401b67 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 002831ee72..37ff46fc55 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)) { |