From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [PATCH] fix usb-hid emulation
Date: Wed, 07 Jan 2009 12:26:48 +0000 [thread overview]
Message-ID: <49649F88.3010508@eu.citrix.com> (raw)
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@eu.citrix.com>
---
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 */
reply other threads:[~2009-01-07 12:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49649F88.3010508@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.