diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-10-14 10:46:35 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-10-14 10:46:35 -0500 |
commit | bdc792d3875ee0e8c824bcd7820ab08ff2bd5e24 (patch) | |
tree | ce9dae3c409a2614c0d58dbc0894ecef9e8dcc76 /hw/usb.c | |
parent | 36f490b176afab3096e9c2877b365354f67e269d (diff) | |
parent | 80cf7cf74f29a219e02b50f27c12b1c792ebf99b (diff) |
Merge remote-tracking branch 'kraxel/usb.28' into staging
Diffstat (limited to 'hw/usb.c')
-rw-r--r-- | hw/usb.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -33,6 +33,7 @@ void usb_attach(USBPort *port) assert(dev != NULL); assert(dev->attached); + assert(dev->state == USB_STATE_NOTATTACHED); port->ops->attach(port); usb_send_msg(dev, USB_MSG_ATTACH); } @@ -42,10 +43,21 @@ void usb_detach(USBPort *port) USBDevice *dev = port->dev; assert(dev != NULL); + assert(dev->state != USB_STATE_NOTATTACHED); port->ops->detach(port); usb_send_msg(dev, USB_MSG_DETACH); } +void usb_reset(USBPort *port) +{ + USBDevice *dev = port->dev; + + assert(dev != NULL); + usb_detach(port); + usb_attach(port); + usb_send_msg(dev, USB_MSG_RESET); +} + void usb_wakeup(USBDevice *dev) { if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) { |