Skip to contentSkip to conversation

Mouse stops responding when wheel is used in Windows VM

PATCH James Song 2 participants 2 messages Mar 20, 2009

lore
Share & tools
lore

James Song

author
#0 lore raw

I have found that when I attempt to use the wheel to scroll in a Windows VM, the mouse becomes unresponsive for several moments. It appears as though during that time, the wheel scroll events are still being passed into the guest.

patch to fix it:

tools/ioemu-remote/hw/usb-hid.c Fri Feb 20 11:13:38 2009 +0800 renamed from tools/ioemu-remote/hw/usb-hid.c Wed Feb 04 14:58:01 2009 +0800 +2 -1
diff -r 2d7858d7c9f4 tools/ioemu-remote/hw/usb-hid.c
@@ -551,6 +551,8 @@
     e = &s->queue[s->head];
 
     dz = int_clamp(e->dz, -127, 127);
+    if(dz)
+        e->dz = 0;
 
     if (s->xyrel) {
         dx = int_clamp(e->xdx, -127, 127);
@@ -593,7 +595,6 @@
 
     case USB_TABLET:
  /* Appears we have to invert the wheel direction */
- dz = 0 - dz;
 
  buf[0] = b;
  buf[1] = dx & 0xff;

--James Song ( Song Wei )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 22 lines · James Song

I have found that when I attempt to use the wheel to scroll in a Windows VM, the mouse becomes unresponsive for several moments. It appears as though during that time, the wheel scroll events are still being passed into the guest.

patch to fix it:

diff -r 2d7858d7c9f4 tools/ioemu-remote/hw/usb-hid.c

tools/ioemu-remote/hw/usb-hid.c Fri Feb 20 11:13:38 2009 +0800 renamed from tools/ioemu-remote/hw/usb-hid.c Wed Feb 04 14:58:01 2009 +0800 +2 -0
@@ -551,6 +551,8 @@
     e = &s->queue[s->head];
 
     dz = int_clamp(e->dz, -127, 127);
+    if(dz)
+        e->dz = 0;
 
     if (s->xyrel) {
         dx = int_clamp(e->xdx, -127, 127);

tools/ioemu-remote/hw/usb-hid.c Fri Feb 20 11:13:38 2009 +0800 line 600

Quoted 7 lines
tools/ioemu-remote/hw/usb-hid.c Fri Feb 20 11:13:38 2009 +0800 renamed from tools/ioemu-remote/hw/usb-hid.c Wed Feb 04 14:58:01 2009 +0800 +0 -1
@@ -593,7 +595,6 @@
 
     case USB_TABLET:
  /* Appears we have to invert the wheel direction */
- dz = 0 - dz;
 
  buf[0] = b;
  buf[1] = dx & 0xff;

This patch (or a very similar one) seems to be already in the tree:

commit 70543c9952d2ff9f6fddb0a0948218e8e6f2dacb

Author: Ian Jackson <[email protected]>
Date:   Thu Dec 11 18:04:47 2008 +0000

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 ]