aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trace-events8
-rw-r--r--ui/input.c48
2 files changed, 56 insertions, 0 deletions
diff --git a/trace-events b/trace-events
index d86f98cb31..fcdd570096 100644
--- a/trace-events
+++ b/trace-events
@@ -1020,6 +1020,14 @@ gd_switch(int width, int height) "width=%d, height=%d"
gd_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d"
gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)"
+# ui/input.c
+input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%d, down %d"
+input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d"
+input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s, down %d"
+input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s, value %d"
+input_event_abs(int conidx, const char *axis, int value) "con %d, axis %s, value 0x%x"
+input_event_sync(void) ""
+
# hw/display/vmware_vga.c
vmware_value_read(uint32_t index, uint32_t value) "index %d, value 0x%x"
vmware_value_write(uint32_t index, uint32_t value) "index %d, value 0x%x"
diff --git a/ui/input.c b/ui/input.c
index 01991cb2c0..60302b1d3c 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -1,6 +1,8 @@
#include "sysemu/sysemu.h"
#include "qapi-types.h"
+#include "trace.h"
#include "ui/input.h"
+#include "ui/console.h"
struct QemuInputHandlerState {
DeviceState *dev;
@@ -75,6 +77,48 @@ static void qemu_input_transform_abs_rotate(InputEvent *evt)
}
}
+static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
+{
+ const char *name;
+ int idx = -1;
+
+ if (src) {
+ idx = qemu_console_get_index(src);
+ }
+ switch (evt->kind) {
+ case INPUT_EVENT_KIND_KEY:
+ switch (evt->key->key->kind) {
+ case KEY_VALUE_KIND_NUMBER:
+ trace_input_event_key_number(idx, evt->key->key->number,
+ evt->key->down);
+ break;
+ case KEY_VALUE_KIND_QCODE:
+ name = QKeyCode_lookup[evt->key->key->qcode];
+ trace_input_event_key_qcode(idx, name, evt->key->down);
+ break;
+ case KEY_VALUE_KIND_MAX:
+ /* keep gcc happy */
+ break;
+ }
+ break;
+ case INPUT_EVENT_KIND_BTN:
+ name = InputButton_lookup[evt->btn->button];
+ trace_input_event_btn(idx, name, evt->btn->down);
+ break;
+ case INPUT_EVENT_KIND_REL:
+ name = InputAxis_lookup[evt->rel->axis];
+ trace_input_event_rel(idx, name, evt->rel->value);
+ break;
+ case INPUT_EVENT_KIND_ABS:
+ name = InputAxis_lookup[evt->abs->axis];
+ trace_input_event_abs(idx, name, evt->abs->value);
+ break;
+ case INPUT_EVENT_KIND_MAX:
+ /* keep gcc happy */
+ break;
+ }
+}
+
void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
{
QemuInputHandlerState *s;
@@ -83,6 +127,8 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
return;
}
+ qemu_input_event_trace(src, evt);
+
/* pre processing */
if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) {
qemu_input_transform_abs_rotate(evt);
@@ -102,6 +148,8 @@ void qemu_input_event_sync(void)
return;
}
+ trace_input_event_sync();
+
QTAILQ_FOREACH(s, &handlers, node) {
if (!s->events) {
continue;