summary refs log tree commit diff stats
path: root/hw/hid.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-08-09 12:35:57 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-08-10 14:14:00 +0200
commit21635e121ae0f0ab7874152a7c2f96e9d8cd642f (patch)
tree74456d318f14e426ad2f19e75f0eb686bbd0dbf5 /hw/hid.c
parentb9c6cbff76061537b722d55f0e321dde2a612a23 (diff)
downloadfocaccia-qemu-21635e121ae0f0ab7874152a7c2f96e9d8cd642f.tar.gz
focaccia-qemu-21635e121ae0f0ab7874152a7c2f96e9d8cd642f.zip
usb/hid: add hid_pointer_activate, use it
HID reorganziation broke the usb tablet in windows xp.  The reason is
that xp activates idle before it starts polling, which creates a
chicken-and-egg issue:  We don't call hid_pointer_poll because there are
no pending events.  We don't get any events because the activation code
in hid_pointer_poll is never executed and thus all pointer events are
routed to the PS/2 mouse by qemu.

Fix this by creating a hid_pointer_activate function and call it from
usb-hid when the guest sets the idle state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/hid.c')
-rw-r--r--hw/hid.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/hid.c b/hw/hid.c
index 7b5ef5fc92..77339f7a12 100644
--- a/hw/hid.c
+++ b/hw/hid.c
@@ -218,16 +218,21 @@ static inline int int_clamp(int val, int vmin, int vmax)
     }
 }
 
+void hid_pointer_activate(HIDState *hs)
+{
+    if (!hs->ptr.mouse_grabbed) {
+        qemu_activate_mouse_event_handler(hs->ptr.eh_entry);
+        hs->ptr.mouse_grabbed = 1;
+    }
+}
+
 int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len)
 {
     int dx, dy, dz, b, l;
     int index;
     HIDPointerEvent *e;
 
-    if (!hs->ptr.mouse_grabbed) {
-        qemu_activate_mouse_event_handler(hs->ptr.eh_entry);
-        hs->ptr.mouse_grabbed = 1;
-    }
+    hid_pointer_activate(hs);
 
     /* When the buffer is empty, return the last event.  Relative
        movements will all be zero.  */