diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-12-04 15:20:05 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-03-05 09:52:03 +0100 |
commit | c43ce5512fad19896fc952dc769538d5c553f4c9 (patch) | |
tree | 351a745c8c546d84b2054343983a2c3d303ecda0 /ui | |
parent | 21bae11a39570bea2d7c839d01363dafdab608ce (diff) |
input: trace events
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/input.c | 48 |
1 files changed, 48 insertions, 0 deletions
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; |