Skip to contentSkip to conversation

add input-send-event command

GIT PULL Gerd Hoffmann 3 participants 6 messages Jul 2, 2014 – Jul 3, 2014

lore
Share & tools
lore
#0 lore raw

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

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       | 31 ++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
qapi-schema.json +17 -0
index b11aad2..e44b212 100644
@@ -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)
qmp-commands.hx +63 -0

66 lines not on this page · raw message

ui/input.c +31 -0
index 89d9db7..66f4108 100644
@@ -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) {
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Gerd Hoffmann
Quoted 11 lines · 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)

Quoted 7 lines

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

#3 lore raw
Quoted 3 lines · Peter Maydell
Quoted 1 line

add input-send-event command (2014-07-02 08:40:57 +0200)

Isn't this a new feature?

Yes.

Quoted 2 lines

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

#4 lore raw
Quoted 7 lines · Gerd Hoffmann
Quoted 3 lines · Peter Maydell
Quoted 1 line

add input-send-event command (2014-07-02 08:40:57 +0200)

Isn't this a new feature?

Yes.

Quoted 7 lines
Quoted 2 lines

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

#5 lore raw
In reply to Gerd Hoffmann
Quoted 14 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] 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

Quoted 3 lines · Peter Maydell
Quoted 1 line

add input-send-event command (2014-07-02 08:40:57 +0200)

Isn't this a new feature?

Quoted 8 lines

Yes.

Quoted 2 lines

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

Quoted 6 lines

But it isn't really urgent, it can wait for 2.2 opening.

cheers,
Gerd