Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20141113…
Browse files Browse the repository at this point in the history
…-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) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"

* 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 <[email protected]>
  • Loading branch information
pm215 committed Nov 13, 2014
2 parents 410bd78 + 51fc447 commit e08d300
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
9 changes: 7 additions & 2 deletions qapi-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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.
#
Expand All @@ -3254,7 +3259,7 @@
#
##
{ 'command': 'input-send-event',
'data': { 'console':'int', 'events': [ 'InputEvent' ] } }
'data': { '*console':'int', 'events': [ 'InputEvent' ] } }

##
# @NumaOptions
Expand Down
4 changes: 2 additions & 2 deletions qmp-commands.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},

Expand All @@ -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
Expand Down
15 changes: 9 additions & 6 deletions ui/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit e08d300

Please sign in to comment.