From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xat39-0008F3-S2 for qemu-devel@nongnu.org; Sun, 05 Oct 2014 17:09:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xat33-0007HY-QZ for qemu-devel@nongnu.org; Sun, 05 Oct 2014 17:09:03 -0400 Received: from ssl.serverraum.org ([88.198.40.39]:59139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xat33-0007HM-KC for qemu-devel@nongnu.org; Sun, 05 Oct 2014 17:08:57 -0400 From: Michael Walle Date: Sun, 5 Oct 2014 23:08:52 +0200 Message-Id: <1412543332-7469-1-git-send-email-michael@walle.cc> Subject: [Qemu-devel] [PATCH] milkymist: softmmu: fix event handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Walle , Gerd Hoffmann 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. Fixes this by fetching all pending events in the callback handler. Signed-off-by: Michael Walle Cc: Gerd Hoffmann --- hw/input/milkymist-softusb.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 5a427f0..7b0f4db 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); + } } } -- 2.1.1