QMP/input-send-event: make console parameter optional
Hi,
Input patch queue with a little documentation tweak and a patch to make the input-send-event console parameter optional. I'd like to have that API fix in 2.2 because we've added input-send-event in the 2.2 cycle, so fixing this *now* makes things easier for libvirt as we don't have two variations of the API in released qemu versions.
cheers,
Gerd
The following changes since commit 558c2c8ddfb165a36eb95dc93125c04829d68aa7:
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2014-11-10 16:28:51 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-input-20141113-1
for you to fetch changes up to 51fc44768a5b71ad78fa40e609a58f71ed62775a:
QMP/input-send-event: make console parameter optional (2014-11-13 11:06:40 +0100)
----------------------------------------------------------------
QMP/input-send-event: make console parameter optional
----------------------------------------------------------------
Amos Kong (2):
QMP/input-send-event: update document of union InputEvent QMP/input-send-event: make console parameter optional
qapi-schema.json | 9 +++++++-- qmp-commands.hx | 4 ++-- ui/input.c | 15 +++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-)
From: Amos Kong <[email protected]>
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.
--- qapi-schema.json | 4 ++-- qmp-commands.hx | 4 ++-- ui/input.c | 15 +++++++++------ 3 files changed, 13 insertions(+), 10 deletions(-)
qapi-schema.json +2 -2
@@ -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
qmp-commands.hx +2 -2
@@ -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
ui/input.c +9 -6
@@ -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 )) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL for-2.2 1/2] QMP/input-send-event: update document of union InputEvent
In reply to Gerd HoffmannFrom: Amos Kong <[email protected]>
--- qapi-schema.json | 5 +++++ 1 file changed, 5 insertions(+)
qapi-schema.json +5 -0
@@ -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',
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 20 lines · Gerd Hoffmann
Hi,
Input patch queue with a little documentation tweak and a patch to make the input-send-event console parameter optional. I'd like to have that API fix in 2.2 because we've added input-send-event in the 2.2 cycle, so fixing this *now* makes things easier for libvirt as we don't have two variations of the API in released qemu versions.
cheers,
GerdThe following changes since commit
558c2c8ddfb165a36eb95dc93125c04829d68aa7:Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2014-11-10 16:28:51 +0000)
are available in the git repository at:
git://git.kraxel.org/qemutags/pull-input-20141113-1
Quoted 8 lines
for you to fetch changes up to
51fc44768a5b71ad78fa40e609a58f71ed62775a:QMP/input-send-event: make console parameter optional (2014-11-13 11:06:40 +0100)
----------------------------------------------------------------
QMP/input-send-event: make console parameter optional----------------------------------------------------------------
Applied, thanks.
-- PMM