From: Michael Walle Date: Tue, 9 Aug 2011 21:54:52 +0000 (+0200) Subject: hid: register kbd hander in init() X-Git-Tag: v1.0-rc0~518^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb0db5273f51629e2c900a27b45b9f8c44ad0e8d;p=thirdparty%2Fqemu.git hid: register kbd hander in init() Register the keyboard event handler in hid's init() instead of its reset() function. Signed-off-by: Michael Walle Signed-off-by: Gerd Hoffmann --- diff --git a/hw/hid.c b/hw/hid.c index 77339f7a120..3dc4246cf14 100644 --- a/hw/hid.c +++ b/hw/hid.c @@ -364,7 +364,6 @@ void hid_reset(HIDState *hs) { switch (hs->kind) { case HID_KEYBOARD: - qemu_add_kbd_event_handler(hid_keyboard_event, hs); memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; @@ -398,7 +397,9 @@ void hid_init(HIDState *hs, int kind, HIDEventFunc event) hs->kind = kind; hs->event = event; - if (hs->kind == HID_MOUSE) { + if (hs->kind == HID_KEYBOARD) { + qemu_add_kbd_event_handler(hid_keyboard_event, hs); + } else if (hs->kind == HID_MOUSE) { hs->ptr.eh_entry = qemu_add_mouse_event_handler(hid_pointer_event, hs, 0, "QEMU HID Mouse"); } else if (hs->kind == HID_TABLET) {