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
Hans de Goede c8dfc6
From: Hans de Goede <hdegoede@redhat.com>
Hans de Goede 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
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
5544c1
index a590cb2..f1bb692 100644
Hans de Goede c8dfc6
--- a/hw/usb/redirect.c
Hans de Goede c8dfc6
+++ b/hw/usb/redirect.c
5544c1
@@ -833,6 +833,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
-- 
5544c1
1.7.12.1
Hans de Goede c8dfc6