From patchwork Fri Dec 17 11:26:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 75892 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2FA1F1007D3 for ; Sat, 18 Dec 2010 00:17:03 +1100 (EST) Received: from localhost ([127.0.0.1]:57445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTYmF-0008B2-Qz for incoming@patchwork.ozlabs.org; Fri, 17 Dec 2010 06:47:12 -0500 Received: from [140.186.70.92] (port=39247 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTYT7-00086F-1Y for qemu-devel@nongnu.org; Fri, 17 Dec 2010 06:27:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTYT2-0007VJ-Vo for qemu-devel@nongnu.org; Fri, 17 Dec 2010 06:27:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTYT2-0007VB-L1 for qemu-devel@nongnu.org; Fri, 17 Dec 2010 06:27:20 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBHBRJj9030444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Dec 2010 06:27:20 -0500 Received: from rincewind.home.kraxel.org (vpn2-10-81.ams2.redhat.com [10.36.10.81]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBHBQwR0026338; Fri, 17 Dec 2010 06:27:18 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 1A6734135D; Fri, 17 Dec 2010 12:26:48 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Dec 2010 12:26:35 +0100 Message-Id: <1292585206-24862-20-git-send-email-kraxel@redhat.com> In-Reply-To: <1292585206-24862-1-git-send-email-kraxel@redhat.com> References: <1292585206-24862-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 19/30] usb: hub: remote wakeup support. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch makes the usb hub handle remote wakeup requests from devices properly by updating the port status register and forwarding the wakeup to the upstream port. Signed-off-by: Gerd Hoffmann --- hw/usb-hub.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 5aa1d0b..9a073f8 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -245,6 +245,17 @@ static void usb_hub_detach(USBPort *port1) } } +static void usb_hub_wakeup(USBDevice *dev) +{ + USBHubState *s = dev->port->opaque; + USBHubPort *port = &s->ports[dev->port->index]; + + if (port->wPortStatus & PORT_STAT_SUSPEND) { + port->wPortChange |= PORT_STAT_C_SUSPEND; + usb_wakeup(&s->dev); + } +} + static void usb_hub_handle_reset(USBDevice *dev) { /* XXX: do it */ @@ -502,6 +513,7 @@ static void usb_hub_handle_destroy(USBDevice *dev) static USBPortOps usb_hub_port_ops = { .attach = usb_hub_attach, .detach = usb_hub_detach, + .wakeup = usb_hub_wakeup, }; static int usb_hub_initfn(USBDevice *dev)