From patchwork Wed Oct 12 11:30:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 119186 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AF7FCB6F7C for ; Wed, 12 Oct 2011 22:30:38 +1100 (EST) Received: from localhost ([::1]:46184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDx17-0003Xe-8l for incoming@patchwork.ozlabs.org; Wed, 12 Oct 2011 07:30:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDx0y-0003XU-Q5 for qemu-devel@nongnu.org; Wed, 12 Oct 2011 07:30:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDx0u-0001Q0-R6 for qemu-devel@nongnu.org; Wed, 12 Oct 2011 07:30:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDx0u-0001Pr-HV for qemu-devel@nongnu.org; Wed, 12 Oct 2011 07:30:20 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9CBUJWx029857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Oct 2011 07:30:19 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9CBUIRw032120; Wed, 12 Oct 2011 07:30:19 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 2BF364037B; Wed, 12 Oct 2011 13:30:35 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 12 Oct 2011 13:30:34 +0200 Message-Id: <1318419034-15287-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] usb-hid: activate usb tablet / mouse after migration. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org qemu uses the ps/2 mouse by default. The usb tablet (or mouse) is activated as soon as qemu sees some guest activity on the device, i.e. polling for HID events. That used to work fine for both fresh boot and migration. Remote wakeup support changed the picture though: There will be no polling after migration in case the guest suspended the usb bus, waiting for wakeup events. Result is that the ps/2 mouse stays active. Fix this by activating the usb tablet / mouse in post_load() in case the guest enabled remote wakeup. Signed-off-by: Gerd Hoffmann --- hw/usb-hid.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/hw/usb-hid.c b/hw/usb-hid.c index 7c564b6..997f828 100644 --- a/hw/usb-hid.c +++ b/hw/usb-hid.c @@ -520,10 +520,21 @@ static int usb_keyboard_initfn(USBDevice *dev) return usb_hid_initfn(dev, HID_KEYBOARD); } +static int usb_ptr_post_load(void *opaque, int version_id) +{ + USBHIDState *s = opaque; + + if (s->dev.remote_wakeup) { + hid_pointer_activate(&s->hid); + } + return 0; +} + static const VMStateDescription vmstate_usb_ptr = { .name = "usb-ptr", .version_id = 1, .minimum_version_id = 1, + .post_load = usb_ptr_post_load, .fields = (VMStateField []) { VMSTATE_USB_DEVICE(dev, USBHIDState), VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),