WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] fix usb-hid emulation

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] fix usb-hid emulation
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 07 Jan 2009 12:26:48 +0000
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Wed, 07 Jan 2009 04:28:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (X11/20080505)
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 <=