QMP/input-send-event: make console parameter optional

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJUZILeAAoJEEy22O7T6HE4GEUP/ifgp2zb7u/92UEBRcHFk08s
 fway1QJg/3aWCropLAh1ns+thh1XKn1Q6xOkyqdM2v+C7bsqcd94Dyw3Gha6R96I
 yIbkqggkjyRdE24A4fY/xBuERNWK3Sf2bNk+lCgLzCQSpCl615NBiqhT1+TY0AIE
 rvCBB7MzmAjMKY6P/FxjrwV1E40vZ3fJUwroDx5ZrHx3CAG9n5I05nGe8JZxZP16
 SE0RfStzP8B9z5/sZmxsURZ3ZaeXBmbBEU+9OtcRxbkiCE53gvhFXXKuqGIjnO+i
 D7FTipts7AJ1ggQj8SDSUc6oILWDiLhqPQMPwYrRRZhFEUN4zY44izYwe+yGURC1
 Sv6TkNRv/jqsQAW6Vo9cd++f/knWqs1JeTWzzH/j0PaX5egfdvjXzxK3I2p7Y2IC
 z9r/cfIKi0Piei3V+b885V8SCmkudLgnrfcfR5G06ZLWCCcUlNSCgB2P7PkAyUzT
 sPEJaDFwSUOLW//1h53j1/si6/WE65lYWp/K+4TS1bq9/OeM0xY4PMaIgkapk0no
 4oed7wlJqozYDs+33HM/mIc+gIx/E9VAWNgoJ+6JyK7gAi4MU421f1IvPtZ57w8u
 G48nITYQrpkPoaBru3ApptIRydgwQf22yzMIgA/c4lMC3FWUKfpYOxrkvy5PRnCZ
 beinmgQt8r5kJCkbeqrs
 =l7/I
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2014-11-13 11:52:11 +00:00
commit e08d300450
3 changed files with 18 additions and 10 deletions

View File

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

View File

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

View File

@ -122,17 +122,20 @@ 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 = 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)) {
error_setg(errp, "VM not running");