From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46293 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P4ADm-0004KC-VR for qemu-devel@nongnu.org; Fri, 08 Oct 2010 06:30:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4ADb-0007PJ-HI for qemu-devel@nongnu.org; Fri, 08 Oct 2010 06:30:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P4ADb-0007Op-9z for qemu-devel@nongnu.org; Fri, 08 Oct 2010 06:30:27 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o98AUQp1003520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 8 Oct 2010 06:30:26 -0400 From: Gerd Hoffmann Date: Fri, 8 Oct 2010 12:30:14 +0200 Message-Id: <1286533814-1012-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1286533814-1012-1-git-send-email-kraxel@redhat.com> References: <1286533814-1012-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] wacom tablet: activate event handlers. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: hdegoede@redhat.com, Gerd Hoffmann 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 --- hw/usb-wacom.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c index fe052eb..47f26cd 100644 --- a/hw/usb-wacom.c +++ b/hw/usb-wacom.c @@ -160,6 +160,7 @@ static int usb_mouse_poll(USBWacomState *s, uint8_t *buf, int len) 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 @@ static int usb_wacom_poll(USBWacomState *s, uint8_t *buf, int len) 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 @@ static int usb_wacom_handle_control(USBDevice *dev, int request, int value, 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 @@ static void usb_wacom_handle_destroy(USBDevice *dev) { 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) -- 1.7.1