|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH] fix usb-hid emulation
Hi all,
there is a bug in the current usb-hid emulation code that affects the
way the idle flag is handled: the spec clearly states that when SET_IDLE
is called with a value == 0 means "do not send any event unless there is
an actual change". However we are currently assuming the opposite
meaning of the flag.
This patch fixes it and it also fixes a possible initialization issue
that is uncovered by using the default idle flag set to 0.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
diff -r d2ff8a90436e hw/usb-hid.c
--- a/hw/usb-hid.c Tue Dec 16 16:03:12 2008 +0000
+++ b/hw/usb-hid.c Wed Jan 07 12:22:38 2009 +0000
@@ -541,8 +541,8 @@
static int usb_suppress_report(USBHIDState *hs, int unchanged) {
/* TODO: Implement finite idle delays. */
- if (!hs->idle) return 0; /* SET_IDLE 0 means always report */
- return unchanged;
+ if (!hs->idle && unchanged) return 1; /* SET_IDLE 0 means do not report */
+ else return 0;
}
static int usb_pointer_poll(USBHIDState *hs, uint8_t *buf, int len)
@@ -551,14 +551,14 @@
USBPointerState *s = &hs->ptr;
USBPointerEvent *e;
- if (usb_suppress_report(hs, s->head == s->tail))
- return USB_RET_NAK;
-
if (!s->mouse_grabbed) {
s->eh_entry = qemu_add_mouse_event_handler(usb_pointer_event, hs,
!s->xyrel, "QEMU USB Pointer");
s->mouse_grabbed = 1;
}
+
+ if (usb_suppress_report(hs, s->head == s->tail))
+ return USB_RET_NAK;
if (s->head == s->tail)
/* use the last report */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-devel] [PATCH] fix usb-hid emulation,
Stefano Stabellini <=
|
|
|
|
|