summary refs log tree commit diff stats
path: root/hw/usb/host-linux.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-07-03 10:11:21 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-07-09 11:59:54 +0200
commit19deaa089cb874912767bc6071f3b7372d3ff961 (patch)
tree7620b7aa28c64623ced9885826353f858725eb29 /hw/usb/host-linux.c
parentadae502c0ae4572ef08f71cb5b5ed5a8e90299fe (diff)
downloadfocaccia-qemu-19deaa089cb874912767bc6071f3b7372d3ff961.tar.gz
focaccia-qemu-19deaa089cb874912767bc6071f3b7372d3ff961.zip
usb: split endpoint init and reset
Create a new usb_ep_reset() function to reset endpoint state, without
re-initialiting the queues, so we don't unlink in-flight packets just
because usb-host has to re-parse the descriptor tables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/host-linux.c')
-rw-r--r--hw/usb/host-linux.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index 5479fb5987..9ba892505a 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -1136,7 +1136,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
     USBDescriptor *d;
     bool active = false;
 
-    usb_ep_init(&s->dev);
+    usb_ep_reset(&s->dev);
 
     for (i = 0;; i += d->bLength) {
         if (i+2 >= s->descr_len) {
@@ -1239,7 +1239,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
     return 0;
 
 error:
-    usb_ep_init(&s->dev);
+    usb_ep_reset(&s->dev);
     return 1;
 }
 
@@ -1326,6 +1326,7 @@ static int usb_host_open(USBHostDevice *dev, int bus_num,
         goto fail;
     }
 
+    usb_ep_init(&dev->dev);
     ret = usb_linux_update_endp_table(dev);
     if (ret) {
         goto fail;