render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone
Blob Blame History Raw
From 89c9752afa77c6936ab9839d8fb1ce42147086b2 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 29 Mar 2012 16:41:23 +0200
Subject: [PATCH 143/146] usb-redir: Notify our peer when we reject a device
 due to a speed mismatch

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 usb-redir.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/usb-redir.c b/usb-redir.c
index f64443e..8ee3f07 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -845,7 +845,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.9.3