From: Hans de Goede <hdego...@redhat.com>

Also cleanup (reset) our device state when we reject a device due to a
speed mismatch.

Signed-off-by: Hans de Goede <hdego...@redhat.com>
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 hw/usb/redirect.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 4288324..94ab463 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -836,7 +836,13 @@ static void usbredir_do_attach(void *opaque)
 {
     USBRedirDevice *dev = opaque;
 
-    usb_device_attach(&dev->dev);
+    if (usb_device_attach(&dev->dev) != 0) {
+        usbredir_device_disconnect(dev);
+        if (usbredirparser_peer_has_cap(dev->parser, usb_redir_cap_filter)) {
+            usbredirparser_send_filter_reject(dev->parser);
+            usbredirparser_do_write(dev->parser);
+        }
+    }
 }
 
 /*
-- 
1.7.1


Reply via email to