]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hid: register kbd hander in init()
authorMichael Walle <michael@walle.cc>
Tue, 9 Aug 2011 21:54:52 +0000 (23:54 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 10 Aug 2011 12:14:00 +0000 (14:14 +0200)
Register the keyboard event handler in hid's init() instead of its reset()
function.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/hid.c

index 77339f7a1204d722c918ddb25f60c8c0dccacadb..3dc4246cf1489e63424d19e19e980c64894d1081 100644 (file)
--- 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) {