From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56087 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pcyl3-00069p-7C for qemu-devel@nongnu.org; Wed, 12 Jan 2011 06:20:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pcyl0-0001aC-I5 for qemu-devel@nongnu.org; Wed, 12 Jan 2011 06:20:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pcyl0-0001Zp-BE for qemu-devel@nongnu.org; Wed, 12 Jan 2011 06:20:50 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0CBKnhP011779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Jan 2011 06:20:49 -0500 From: Gerd Hoffmann Date: Wed, 12 Jan 2011 12:19:59 +0100 Message-Id: <1294831214-4499-18-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 17/32] usb: add usb_wakeup() + wakeup callback to port ops List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 3744d19..250ec71 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 */ @@ -275,6 +276,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); -- 1.7.1