peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

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

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