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 | |
parent | 21bae11a39570bea2d7c839d01363dafdab608ce (diff) | |
download | qemu-c43ce5512fad19896fc952dc769538d5c553f4c9.zip qemu-c43ce5512fad19896fc952dc769538d5c553f4c9.tar.gz qemu-c43ce5512fad19896fc952dc769538d5c553f4c9.tar.bz2 |
input: trace events
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | trace-events | 8 | ||||
-rw-r--r-- | ui/input.c | 48 |
2 files changed, 56 insertions, 0 deletions
diff --git a/trace-events b/trace-events index d86f98c..fcdd570 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" @@ -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; |