From patchwork Fri Dec 17 11:26:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 75890 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 C29DCB7082 for ; Sat, 18 Dec 2010 00:16:04 +1100 (EST) Received: from localhost ([127.0.0.1]:57800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTYmx-0008Np-PE for incoming@patchwork.ozlabs.org; Fri, 17 Dec 2010 06:47:55 -0500 Received: from [140.186.70.92] (port=39241 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTYT5-00085y-OI for qemu-devel@nongnu.org; Fri, 17 Dec 2010 06:27:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTYT1-0007Uz-Tp for qemu-devel@nongnu.org; Fri, 17 Dec 2010 06:27:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTYT1-0007Uq-MR for qemu-devel@nongnu.org; Fri, 17 Dec 2010 06:27:19 -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 oBHBRIx3029546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Dec 2010 06:27:19 -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 oBHBQxE8026342; Fri, 17 Dec 2010 06:27:17 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id F33CF4132A; Fri, 17 Dec 2010 12:26:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Dec 2010 12:26:33 +0100 Message-Id: <1292585206-24862-18-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 17/30] usb: add usb_wakeup() + wakeup callback to port ops 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 Add wakeup callback to port ops for remote wakeup handling. Also add a usb_wakeup() function for devices which want trigger a remote wakeup. Signed-off-by: Gerd Hoffmann --- hw/usb.c | 7 +++++++ hw/usb.h | 2 ++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/hw/usb.c b/hw/usb.c index 2eda86a..ba720b4 100644 --- a/hw/usb.c +++ b/hw/usb.c @@ -49,6 +49,13 @@ void usb_attach(USBPort *port, USBDevice *dev) } } +void usb_wakeup(USBDevice *dev) +{ + if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) { + dev->port->ops->wakeup(dev); + } +} + /**********************/ /* generic USB device helpers (you are not forced to use them when diff --git a/hw/usb.h b/hw/usb.h index 6b008cc..9f454e6 100644 --- a/hw/usb.h +++ b/hw/usb.h @@ -220,6 +220,7 @@ struct USBDeviceInfo { typedef struct USBPortOps { void (*attach)(USBPort *port); void (*detach)(USBPort *port); + void (*wakeup)(USBDevice *dev); } USBPortOps; /* USB port on which a device can be connected */ @@ -274,6 +275,7 @@ static inline void usb_cancel_packet(USBPacket * p) } void usb_attach(USBPort *port, USBDevice *dev); +void usb_wakeup(USBDevice *dev); int usb_generic_handle_packet(USBDevice *s, USBPacket *p); int set_usb_string(uint8_t *buf, const char *str); void usb_send_msg(USBDevice *dev, int msg);