mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 07:02:03 -06:00
input: trace events
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
21bae11a39
commit
c43ce5512f
2 changed files with 56 additions and 0 deletions
|
@ -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_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)"
|
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
|
# hw/display/vmware_vga.c
|
||||||
vmware_value_read(uint32_t index, uint32_t value) "index %d, value 0x%x"
|
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"
|
vmware_value_write(uint32_t index, uint32_t value) "index %d, value 0x%x"
|
||||||
|
|
48
ui/input.c
48
ui/input.c
|
@ -1,6 +1,8 @@
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "qapi-types.h"
|
#include "qapi-types.h"
|
||||||
|
#include "trace.h"
|
||||||
#include "ui/input.h"
|
#include "ui/input.h"
|
||||||
|
#include "ui/console.h"
|
||||||
|
|
||||||
struct QemuInputHandlerState {
|
struct QemuInputHandlerState {
|
||||||
DeviceState *dev;
|
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)
|
void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
|
||||||
{
|
{
|
||||||
QemuInputHandlerState *s;
|
QemuInputHandlerState *s;
|
||||||
|
@ -83,6 +127,8 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qemu_input_event_trace(src, evt);
|
||||||
|
|
||||||
/* pre processing */
|
/* pre processing */
|
||||||
if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) {
|
if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) {
|
||||||
qemu_input_transform_abs_rotate(evt);
|
qemu_input_transform_abs_rotate(evt);
|
||||||
|
@ -102,6 +148,8 @@ void qemu_input_event_sync(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace_input_event_sync();
|
||||||
|
|
||||||
QTAILQ_FOREACH(s, &handlers, node) {
|
QTAILQ_FOREACH(s, &handlers, node) {
|
||||||
if (!s->events) {
|
if (!s->events) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue