From 714f9db06c209fd42d67e6dffd4f7fd932b51b65 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 30 Mar 2012 09:53:54 +0200 Subject: 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 Signed-off-by: Gerd Hoffmann --- hw/usb/redirect.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 4288324110..94ab4632ca 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); + } + } } /* -- cgit v1.2.3