From: Ian Jackson Date: Thu, 11 Dec 2008 18:04:47 +0000 (+0000) Subject: usb-hid.c: fix usb mouse wheel X-Git-Tag: xen-3.3.2-rc1~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5b55ab9960475e669aeaa626b48f6cebcbf2bdfe;p=qemu-xen-3.3-testing.git usb-hid.c: fix usb mouse wheel This patch fixes the usb mouse wheel of usb devices. [ Previously, tablets would fail to subtract dz from e->dz thus producing an infinite stream of reports; also the wheel direction inversions had been multipled by merge damage resulting in the wrong number of inversions for mice. -iwj ] Signed-off-by: Stefano Stabellini (cherry picked from commit 70543c9952d2ff9f6fddb0a0948218e8e6f2dacb) --- diff --git a/hw/usb-hid.c b/hw/usb-hid.c index 89fa3d57..6aa26f9b 100644 --- a/hw/usb-hid.c +++ b/hw/usb-hid.c @@ -552,6 +552,7 @@ static int usb_pointer_poll(USBHIDState *hs, uint8_t *buf, int len) dz = int_clamp(e->dz, -127, 127); + e->dz -= dz; if (s->xyrel) { dx = int_clamp(e->xdx, -127, 127); dy = int_clamp(e->ydy, -127, 127); @@ -592,9 +593,6 @@ static int usb_pointer_poll(USBHIDState *hs, uint8_t *buf, int len) break; case USB_TABLET: - /* Appears we have to invert the wheel direction */ - dz = 0 - dz; - buf[0] = b; buf[1] = dx & 0xff; buf[2] = dx >> 8;