From: Michael Walle Date: Sat, 4 Oct 2014 18:00:07 +0000 (+0200) Subject: milkymist: softmmu: fix event handling X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=857cccac0d9450d9be6af1ca3e5b7730b408b33c;p=qmiga%2Fqemu.git milkymist: softmmu: fix event handling Keys which send more than one scancode (esp. windows key) weren't handled correctly since commit 1ff5eedd. Two events were put into the input event queue but only one was processed. This fixes this by fetching all pending events in the callback handler. Signed-off-by: Michael Walle Cc: Gerd Hoffmann --- diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 5a427f0b33..7b0f4db88d 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -194,10 +194,13 @@ static void softusb_kbd_hid_datain(HIDState *hs) return; } - len = hid_keyboard_poll(hs, s->kbd_hid_buffer, sizeof(s->kbd_hid_buffer)); + while (hid_has_events(hs)) { + len = hid_keyboard_poll(hs, s->kbd_hid_buffer, + sizeof(s->kbd_hid_buffer)); - if (len == 8) { - softusb_kbd_changed(s); + if (len == 8) { + softusb_kbd_changed(s); + } } } @@ -212,11 +215,13 @@ static void softusb_mouse_hid_datain(HIDState *hs) return; } - len = hid_pointer_poll(hs, s->mouse_hid_buffer, - sizeof(s->mouse_hid_buffer)); + while (hid_has_events(hs)) { + len = hid_pointer_poll(hs, s->mouse_hid_buffer, + sizeof(s->mouse_hid_buffer)); - if (len == 4) { - softusb_mouse_changed(s); + if (len == 4) { + softusb_mouse_changed(s); + } } }