* [Qemu-devel] [PULL 0/2] input patch queue
@ 2014-10-02 8:12 Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 1/2] input: fix send-key monitor command release event ordering Gerd Hoffmann
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-02 8:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Two input monitor patches: Fix fix send-key release ordering & add new
input-send-event qmp command.
please pull,
Gerd
The following changes since commit 29429c7244c73eefada3d0ec6dd30c5698782d08:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140929' into staging (2014-09-30 11:02:06 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-input-20141002-1
for you to fetch changes up to 50c6617fcbef649674b59f686b12dccfc455ffa3:
add input-send-event command (2014-10-02 09:58:14 +0200)
----------------------------------------------------------------
input monitor patches: fix send-key release ordering
and new input-send-event command
----------------------------------------------------------------
Gerd Hoffmann (1):
input: fix send-key monitor command release event ordering
Marcelo Tosatti (1):
add input-send-event command
qapi-schema.json | 17 +++++++++++++++
qmp-commands.hx | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
ui/input-legacy.c | 11 ++++++++--
ui/input.c | 37 ++++++++++++++++++++++++++++++++
4 files changed, 126 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/2] input: fix send-key monitor command release event ordering
2014-10-02 8:12 [Qemu-devel] [PULL 0/2] input patch queue Gerd Hoffmann
@ 2014-10-02 8:12 ` Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 2/2] add input-send-event command Gerd Hoffmann
2014-10-02 14:55 ` [Qemu-devel] [PULL 0/2] input patch queue Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-02 8:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Amos Kong, Gerd Hoffmann, Anthony Liguori
commit 2e377f1730d06deafb3e3ef6cf88792de4a6f4df changed the ordering
of the release events as side effect. Some guests are not happy with
that and don't recognise ctrl-alt-del any more. This patch restores
the old last-pressed first-released behavior.
Cc: Amos Kong <akong@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/input-legacy.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index 3025f50..a698a34 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -85,6 +85,8 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
Error **errp)
{
KeyValueList *p;
+ KeyValue **up = NULL;
+ int count = 0;
if (!has_hold_time) {
hold_time = 0; /* use default */
@@ -93,11 +95,16 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
for (p = keys; p != NULL; p = p->next) {
qemu_input_event_send_key(NULL, copy_key_value(p->value), true);
qemu_input_event_send_key_delay(hold_time);
+ up = g_realloc(up, sizeof(*up) * (count+1));
+ up[count] = copy_key_value(p->value);
+ count++;
}
- for (p = keys; p != NULL; p = p->next) {
- qemu_input_event_send_key(NULL, copy_key_value(p->value), false);
+ while (count) {
+ count--;
+ qemu_input_event_send_key(NULL, up[count], false);
qemu_input_event_send_key_delay(hold_time);
}
+ g_free(up);
}
static void legacy_kbd_event(DeviceState *dev, QemuConsole *src,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/2] add input-send-event command
2014-10-02 8:12 [Qemu-devel] [PULL 0/2] input patch queue Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 1/2] input: fix send-key monitor command release event ordering Gerd Hoffmann
@ 2014-10-02 8:12 ` Gerd Hoffmann
2014-10-02 14:55 ` [Qemu-devel] [PULL 0/2] input patch queue Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-10-02 8:12 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 | 37 +++++++++++++++++++++++++++++++++
3 files changed, 117 insertions(+)
diff --git a/qapi-schema.json b/qapi-schema.json
index 4bfaf20..2e9e261 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3233,6 +3233,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.2
+#
+##
+{ '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 f581813..1abd619 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3789,3 +3789,66 @@ Example:
-> { "execute": "trace-event-set-state", "arguments": { "name": "qemu_memalign", "enable": "true" } }
<- { "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
+it is 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..002831e 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -122,6 +122,43 @@ 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;
+ }
+ }
+
+ for (e = events; e != NULL; e = e->next) {
+ InputEvent *event = e->value;
+
+ 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/2] input patch queue
2014-10-02 8:12 [Qemu-devel] [PULL 0/2] input patch queue Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 1/2] input: fix send-key monitor command release event ordering Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 2/2] add input-send-event command Gerd Hoffmann
@ 2014-10-02 14:55 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2014-10-02 14:55 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 2 October 2014 09:12, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Two input monitor patches: Fix fix send-key release ordering & add new
> input-send-event qmp command.
>
> please pull,
> Gerd
>
> The following changes since commit 29429c7244c73eefada3d0ec6dd30c5698782d08:
>
> Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140929' into staging (2014-09-30 11:02:06 +0100)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-input-20141002-1
>
> for you to fetch changes up to 50c6617fcbef649674b59f686b12dccfc455ffa3:
>
> add input-send-event command (2014-10-02 09:58:14 +0200)
>
> ----------------------------------------------------------------
> input monitor patches: fix send-key release ordering
> and new input-send-event command
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 0/2] input patch queue
@ 2017-02-20 11:43 Gerd Hoffmann
2017-02-20 16:31 ` Peter Maydell
0 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2017-02-20 11:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Here is the input patch queue, fixing a ps/2 bug and finally merging the
wctablet (2016 gsoc project).
please pull,
Gerd
The following changes since commit ad584d37f2a86b392c25f3f00cc1f1532676c2d1:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-02-16 17:46:52 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-input-20170220-1
for you to fetch changes up to 378af96155d62d90c876ee5e7648803247f1d864:
Add wctablet device (2017-02-20 11:26:28 +0100)
----------------------------------------------------------------
input: add wctablet, ps2 fix
----------------------------------------------------------------
Anatoli Huseu1 (1):
Add wctablet device
Fabian Lesniak (1):
ps2: fix mouse mappings for right/middle button
Makefile.objs | 1 +
backends/Makefile.objs | 2 +-
backends/trace-events | 10 ++
backends/wctablet.c | 369 +++++++++++++++++++++++++++++++++++++++++++++++
chardev/char.c | 1 +
docs/qdev-device-use.txt | 2 +-
include/hw/input/ps2.h | 4 +-
qapi-schema.json | 3 +-
8 files changed, 387 insertions(+), 5 deletions(-)
create mode 100644 backends/trace-events
create mode 100644 backends/wctablet.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/2] input patch queue
2017-02-20 11:43 Gerd Hoffmann
@ 2017-02-20 16:31 ` Peter Maydell
0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2017-02-20 16:31 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 20 February 2017 at 11:43, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Here is the input patch queue, fixing a ps/2 bug and finally merging the
> wctablet (2016 gsoc project).
>
> please pull,
> Gerd
>
> The following changes since commit ad584d37f2a86b392c25f3f00cc1f1532676c2d1:
>
> Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-02-16 17:46:52 +0000)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-input-20170220-1
>
> for you to fetch changes up to 378af96155d62d90c876ee5e7648803247f1d864:
>
> Add wctablet device (2017-02-20 11:26:28 +0100)
>
> ----------------------------------------------------------------
> input: add wctablet, ps2 fix
>
> ----------------------------------------------------------------
> Anatoli Huseu1 (1):
> Add wctablet device
>
> Fabian Lesniak (1):
> ps2: fix mouse mappings for right/middle button
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-02-20 16:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 8:12 [Qemu-devel] [PULL 0/2] input patch queue Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 1/2] input: fix send-key monitor command release event ordering Gerd Hoffmann
2014-10-02 8:12 ` [Qemu-devel] [PULL 2/2] add input-send-event command Gerd Hoffmann
2014-10-02 14:55 ` [Qemu-devel] [PULL 0/2] input patch queue Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2017-02-20 11:43 Gerd Hoffmann
2017-02-20 16:31 ` Peter Maydell
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).