Skip to contentSkip to conversation

input patch queue

GIT PULL Applied Gerd Hoffmann 2 participants 4 messages Oct 2, 2014

lore
Share & tools
lore
#0 lore raw

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(-)
#1 lore raw

[Qemu-devel] [PULL 2/2] add input-send-event command

From: Marcelo Tosatti <[email protected]>

Which allows specification of absolute/relative, up/down and console parameters.

Suggested by Gerd Hoffman.

---
 qapi-schema.json | 17 +++++++++++++++
 qmp-commands.hx  | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/input.c       | 37 +++++++++++++++++++++++++++++++++
 3 files changed, 117 insertions(+)
qapi-schema.json +17 -0
index 4bfaf20..2e9e261 100644
@@ -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)
qmp-commands.hx +63 -0

66 lines not on this page · raw message

ui/input.c +37 -0
index 89d9db7..002831e 100644
@@ -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) {
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 1/2] input: fix send-key monitor command release event ordering

In reply to Gerd Hoffmann

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.

---
 ui/input-legacy.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
ui/input-legacy.c +9 -2
index 3025f50..a698a34 100644
@@ -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,
Signature · 1 line
1.8.3.1
#3 lore raw
In reply to Gerd Hoffmann
Quoted 19 lines · 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:

Quoted 7 lines

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