* [Qemu-devel] [PULL 0/1] add input-send-event command @ 2014-07-02 8:00 Gerd Hoffmann 2014-07-02 8:00 ` [Qemu-devel] [PULL 1/1] " Gerd Hoffmann 2014-07-03 7:57 ` [Qemu-devel] [PULL 0/1] " Peter Maydell 0 siblings, 2 replies; 6+ messages in thread From: Gerd Hoffmann @ 2014-07-02 8:00 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann Hi, Single patch queue, $subject says all ;) please pull, Gerd The following changes since commit 92259b7f434b382fc865d1f65f7d5adeed295749: Update version for v2.1.0-rc0 release (2014-07-01 18:48:01 +0100) are available in the git repository at: git://git.kraxel.org/qemu tags/pull-input-20140702-1 for you to fetch changes up to 7ca90a7b731ac1fdab93b6816790d0d836a6fd7b: add input-send-event command (2014-07-02 08:40:57 +0200) ---------------------------------------------------------------- add input-send-event command ---------------------------------------------------------------- Marcelo Tosatti (1): add input-send-event command qapi-schema.json | 17 +++++++++++++++ qmp-commands.hx | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/input.c | 31 ++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/1] add input-send-event command 2014-07-02 8:00 [Qemu-devel] [PULL 0/1] add input-send-event command Gerd Hoffmann @ 2014-07-02 8:00 ` Gerd Hoffmann 2014-07-03 7:57 ` [Qemu-devel] [PULL 0/1] " Peter Maydell 1 sibling, 0 replies; 6+ messages in thread From: Gerd Hoffmann @ 2014-07-02 8:00 UTC (permalink / raw) To: qemu-devel Cc: Marcelo Tosatti, Markus Armbruster, Luiz Capitulino, Gerd Hoffmann, Anthony Liguori From: Marcelo Tosatti <mtosatti@redhat.com> Which allows specification of absolute/relative, up/down and console parameters. Suggested by Gerd Hoffman. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- qapi-schema.json | 17 +++++++++++++++ qmp-commands.hx | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/input.c | 31 ++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index b11aad2..e44b212 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3229,6 +3229,23 @@ 'abs' : 'InputMoveEvent' } } ## +# @input-send-event +# +# Send input event(s) to guest. +# +# @console: Which console to send event(s) to. +# +# @events: List of InputEvent union. +# +# Returns: Nothing on success. +# +# Since: 2.1 +# +## +{ 'command': 'input-send-event', + 'data': { 'console':'int', 'events': [ 'InputEvent' ] } } + +## # @NumaOptions # # A discriminated record of NUMA options. (for OptsVisitor) diff --git a/qmp-commands.hx b/qmp-commands.hx index 4be4765..48f7857 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3755,3 +3755,66 @@ Example: <- { "return": {} } EQMP + + { + .name = "input-send-event", + .args_type = "console:i,events:q", + .mhandler.cmd_new = qmp_marshal_input_input_send_event, + }, + +SQMP +@input-send-event +----------------- + +Send input event to guest. + +Arguments: + +- "console": console index. +- "events": list of input events. + +The consoles are visible in the qom tree, under +/backend/console[$index]. They have a device link and head property, so +its possible to map which console belongs to which device and display. + +Example (1): + +Press left mouse button. + +-> { "execute": "input-send-event", + "arguments": { "console": 0, + "events": [ { "type": "btn", + "data" : { "down": true, "button": "Left" } } } } +<- { "return": {} } + +-> { "execute": "input-send-event", + "arguments": { "console": 0, + "events": [ { "type": "btn", + "data" : { "down": false, "button": "Left" } } } } +<- { "return": {} } + +Example (2): + +Press ctrl-alt-del. + +-> { "execute": "input-send-event", + "arguments": { "console": 0, "events": [ + { "type": "key", "data" : { "down": true, + "key": {"type": "qcode", "data": "ctrl" } } }, + { "type": "key", "data" : { "down": true, + "key": {"type": "qcode", "data": "alt" } } }, + { "type": "key", "data" : { "down": true, + "key": {"type": "qcode", "data": "delete" } } } ] } } +<- { "return": {} } + +Example (3): + +Move mouse pointer to absolute coordinates (20000, 400). + +-> { "execute": "input-send-event" , + "arguments": { "console": 0, "events": [ + { "type": "abs", "data" : { "axis": "X", "value" : 20000 } }, + { "type": "abs", "data" : { "axis": "Y", "value" : 400 } } ] } } +<- { "return": {} } + +EQMP diff --git a/ui/input.c b/ui/input.c index 89d9db7..66f4108 100644 --- a/ui/input.c +++ b/ui/input.c @@ -122,6 +122,37 @@ qemu_input_find_handler(uint32_t mask, QemuConsole *con) return NULL; } +void qmp_input_send_event(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; + } + + if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { + error_setg(errp, "VM not running"); + return; + } + + for (e = events; e != NULL; e = e->next) { + InputEvent *event = e->value; + + if (!qemu_input_find_handler(1 << event->kind, con)) { + error_setg(errp, "Input handler not found for " + "event type %s", + InputEventKind_lookup[event->kind]); + return; + } + qemu_input_event_send(con, event); + } + qemu_input_event_sync(); +} + static void qemu_input_transform_abs_rotate(InputEvent *evt) { switch (graphic_rotate) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/1] add input-send-event command 2014-07-02 8:00 [Qemu-devel] [PULL 0/1] add input-send-event command Gerd Hoffmann 2014-07-02 8:00 ` [Qemu-devel] [PULL 1/1] " Gerd Hoffmann @ 2014-07-03 7:57 ` Peter Maydell 2014-07-03 8:21 ` Gerd Hoffmann 1 sibling, 1 reply; 6+ messages in thread From: Peter Maydell @ 2014-07-03 7:57 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: QEMU Developers On 2 July 2014 09:00, Gerd Hoffmann <kraxel@redhat.com> wrote: > Hi, > > Single patch queue, $subject says all ;) > > please pull, > Gerd > > The following changes since commit 92259b7f434b382fc865d1f65f7d5adeed295749: > > Update version for v2.1.0-rc0 release (2014-07-01 18:48:01 +0100) > > are available in the git repository at: > > git://git.kraxel.org/qemu tags/pull-input-20140702-1 > > for you to fetch changes up to 7ca90a7b731ac1fdab93b6816790d0d836a6fd7b: > > add input-send-event command (2014-07-02 08:40:57 +0200) Isn't this a new feature? What's the justification (ie bug this fixes) for it going in during hardfreeze? thanks -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/1] add input-send-event command 2014-07-03 7:57 ` [Qemu-devel] [PULL 0/1] " Peter Maydell @ 2014-07-03 8:21 ` Gerd Hoffmann 2014-07-03 8:25 ` Peter Maydell 2014-07-03 8:35 ` Gonglei (Arei) 0 siblings, 2 replies; 6+ messages in thread From: Gerd Hoffmann @ 2014-07-03 8:21 UTC (permalink / raw) To: Peter Maydell; +Cc: QEMU Developers On Do, 2014-07-03 at 08:57 +0100, Peter Maydell wrote: > > add input-send-event command (2014-07-02 08:40:57 +0200) > > Isn't this a new feature? Yes. > What's the justification (ie bug this fixes) > for it going in during hardfreeze? Was sick last week and didn't got the pull request out of the door in time. But it isn't really urgent, it can wait for 2.2 opening. cheers, Gerd ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/1] add input-send-event command 2014-07-03 8:21 ` Gerd Hoffmann @ 2014-07-03 8:25 ` Peter Maydell 2014-07-03 8:35 ` Gonglei (Arei) 1 sibling, 0 replies; 6+ messages in thread From: Peter Maydell @ 2014-07-03 8:25 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: QEMU Developers On 3 July 2014 09:21, Gerd Hoffmann <kraxel@redhat.com> wrote: > On Do, 2014-07-03 at 08:57 +0100, Peter Maydell wrote: >> > add input-send-event command (2014-07-02 08:40:57 +0200) >> >> Isn't this a new feature? > > Yes. > >> What's the justification (ie bug this fixes) >> for it going in during hardfreeze? > > Was sick last week and didn't got the pull request out of the door in > time. > > But it isn't really urgent, it can wait for 2.2 opening. OK, cool. (I suggest you send a new pull request then.) thanks -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/1] add input-send-event command 2014-07-03 8:21 ` Gerd Hoffmann 2014-07-03 8:25 ` Peter Maydell @ 2014-07-03 8:35 ` Gonglei (Arei) 1 sibling, 0 replies; 6+ messages in thread From: Gonglei (Arei) @ 2014-07-03 8:35 UTC (permalink / raw) To: Gerd Hoffmann, Peter Maydell; +Cc: QEMU Developers > -----Original Message----- > From: qemu-devel-bounces+arei.gonglei=huawei.com@nongnu.org > [mailto:qemu-devel-bounces+arei.gonglei=huawei.com@nongnu.org] On > Behalf Of Gerd Hoffmann > Sent: Thursday, July 03, 2014 4:22 PM > To: Peter Maydell > Cc: QEMU Developers > Subject: Re: [Qemu-devel] [PULL 0/1] add input-send-event command > > On Do, 2014-07-03 at 08:57 +0100, Peter Maydell wrote: > > > add input-send-event command (2014-07-02 08:40:57 +0200) > > > > Isn't this a new feature? > > Yes. > > > What's the justification (ie bug this fixes) > > for it going in during hardfreeze? > > Was sick last week and didn't got the pull request out of the door in > time. > Hi, Gerd. I am surprised you did not in the maillist last week. Hope you are feeling better! Best regards, -Gonglei > But it isn't really urgent, it can wait for 2.2 opening. > > cheers, > Gerd > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-03 8:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-02 8:00 [Qemu-devel] [PULL 0/1] add input-send-event command Gerd Hoffmann 2014-07-02 8:00 ` [Qemu-devel] [PULL 1/1] " Gerd Hoffmann 2014-07-03 7:57 ` [Qemu-devel] [PULL 0/1] " Peter Maydell 2014-07-03 8:21 ` Gerd Hoffmann 2014-07-03 8:25 ` Peter Maydell 2014-07-03 8:35 ` Gonglei (Arei)
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).