qemu 0.13.0 cause seg fault in qemu_remove_mouse_event_handler, this patch from
upstream can fix it.

Should remove it in next upgrade if necessary.

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>

commit b2d4d8329963b13c5cebe5944dcc99f0e9d1b5c7
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Fri Oct 8 12:30:14 2010 +0200

    wacom tablet: activate event handlers.
    
    Add qemu_activate_mouse_event_handler() calls to the usb wavom tablet so
    it actually receives events.  Also make sure we only remove the handler
    if we registered it before.
    
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Index: qemu-0.13.0/hw/usb-wacom.c
===================================================================
--- qemu-0.13.0.orig/hw/usb-wacom.c	2010-10-16 04:56:09.000000000 +0800
+++ qemu-0.13.0/hw/usb-wacom.c	2011-01-18 16:58:44.000000000 +0800
@@ -160,6 +160,7 @@
     if (!s->mouse_grabbed) {
         s->eh_entry = qemu_add_mouse_event_handler(usb_mouse_event, s, 0,
                         "QEMU PenPartner tablet");
+        qemu_activate_mouse_event_handler(s->eh_entry);
         s->mouse_grabbed = 1;
     }
 
@@ -197,6 +198,7 @@
     if (!s->mouse_grabbed) {
         s->eh_entry = qemu_add_mouse_event_handler(usb_wacom_event, s, 1,
                         "QEMU PenPartner tablet");
+        qemu_activate_mouse_event_handler(s->eh_entry);
         s->mouse_grabbed = 1;
     }
 
@@ -334,8 +336,10 @@
         ret = 0;
         break;
     case WACOM_SET_REPORT:
-        qemu_remove_mouse_event_handler(s->eh_entry);
-        s->mouse_grabbed = 0;
+        if (s->mouse_grabbed) {
+            qemu_remove_mouse_event_handler(s->eh_entry);
+            s->mouse_grabbed = 0;
+        }
         s->mode = data[0];
         ret = 0;
         break;
@@ -397,7 +401,10 @@
 {
     USBWacomState *s = (USBWacomState *) dev;
 
-    qemu_remove_mouse_event_handler(s->eh_entry);
+    if (s->mouse_grabbed) {
+        qemu_remove_mouse_event_handler(s->eh_entry);
+        s->mouse_grabbed = 0;
+    }
 }
 
 static int usb_wacom_initfn(USBDevice *dev)
