From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56058 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pcyl1-00068W-52 for qemu-devel@nongnu.org; Wed, 12 Jan 2011 06:20:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pcykz-0001ZW-7n for qemu-devel@nongnu.org; Wed, 12 Jan 2011 06:20:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pcyky-0001ZI-UF for qemu-devel@nongnu.org; Wed, 12 Jan 2011 06:20:49 -0500 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.13.8/8.13.8) with ESMTP id p0CBKm2u024920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Jan 2011 06:20:48 -0500 From: Gerd Hoffmann Date: Wed, 12 Jan 2011 12:20:01 +0100 Message-Id: <1294831214-4499-20-git-send-email-kraxel@redhat.com> In-Reply-To: <1294831214-4499-1-git-send-email-kraxel@redhat.com> References: <1294831214-4499-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH v4 19/32] usb: hub: remote wakeup support. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 8837bd9..8a80151 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) -- 1.7.1