Blame 0327-usb-redir-Ensure-our-peer-has-the-necessary-caps-whe.patch

Hans de Goede c8dfc6
From af1ecda005c043dd8186725ae7a93ea66ebfe96f Mon Sep 17 00:00:00 2001
Hans de Goede c8dfc6
From: Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
Date: Mon, 3 Sep 2012 12:04:49 +0200
Hans de Goede c8dfc6
Subject: [PATCH 327/366] usb-redir: Ensure our peer has the necessary caps
Hans de Goede c8dfc6
 when redirecting to XHCI
Hans de Goede c8dfc6
Hans de Goede c8dfc6
In order for redirection to work properly when redirecting to an emulated
Hans de Goede c8dfc6
XHCI controller, the usb-redir-host must support both
Hans de Goede c8dfc6
usb_redir_cap_ep_info_max_packet_size and usb_redir_cap_64bits_ids,
Hans de Goede c8dfc6
reject any devices redirected to an XHCI controller when these are not
Hans de Goede c8dfc6
supported.
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede c8dfc6
---
Hans de Goede c8dfc6
 hw/usb/redirect.c | 11 +++++++++++
Hans de Goede c8dfc6
 1 file changed, 11 insertions(+)
Hans de Goede c8dfc6
Hans de Goede c8dfc6
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
Hans de Goede c8dfc6
index 357f307..5b0f834 100644
Hans de Goede c8dfc6
--- a/hw/usb/redirect.c
Hans de Goede c8dfc6
+++ b/hw/usb/redirect.c
Hans de Goede c8dfc6
@@ -834,6 +834,17 @@ static void usbredir_do_attach(void *opaque)
Hans de Goede c8dfc6
 {
Hans de Goede c8dfc6
     USBRedirDevice *dev = opaque;
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
+    /* In order to work properly with XHCI controllers we need these caps */
Hans de Goede c8dfc6
+    if ((dev->dev.port->speedmask & USB_SPEED_MASK_SUPER) && !(
Hans de Goede c8dfc6
+        usbredirparser_peer_has_cap(dev->parser,
Hans de Goede c8dfc6
+                                    usb_redir_cap_ep_info_max_packet_size) &&
Hans de Goede c8dfc6
+        usbredirparser_peer_has_cap(dev->parser,
Hans de Goede c8dfc6
+                                    usb_redir_cap_64bits_ids))) {
Hans de Goede c8dfc6
+        ERROR("usb-redir-host lacks capabilities needed for use with XHCI\n");
Hans de Goede c8dfc6
+        usbredir_reject_device(dev);
Hans de Goede c8dfc6
+        return;
Hans de Goede c8dfc6
+    }
Hans de Goede c8dfc6
+
Hans de Goede c8dfc6
     if (usb_device_attach(&dev->dev) != 0) {
Hans de Goede c8dfc6
         usbredir_reject_device(dev);
Hans de Goede c8dfc6
     }
Hans de Goede c8dfc6
-- 
Hans de Goede c8dfc6
1.7.12
Hans de Goede c8dfc6