usb: add usb_wakeup() + wakeup callback to port ops

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 <kraxel@redhat.com>
master
Gerd Hoffmann 2010-12-01 11:32:45 +01:00
parent 618c169b57
commit 01eacab6e9
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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);