Skip to content

Commit

Permalink
milkymist: softmmu: fix event handling
Browse files Browse the repository at this point in the history
Keys which send more than one scancode (esp. windows key) weren't handled
correctly since commit 1ff5eed. 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 <michael@walle.cc>
Cc: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
mwalle committed Dec 29, 2014
1 parent ab0302e commit 857ccca
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions hw/input/milkymist-softusb.c
Expand Up @@ -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);
}
}
}

Expand All @@ -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);
}
}
}

Expand Down

0 comments on commit 857ccca

Please sign in to comment.