[Spice-devel] [usbredir PATCH 5/6] usbredirhost: claim/release: ignore NOT_SUPPORTED on attach|detach kernel driver

Uri Lublin uril at redhat.com
Thu May 3 08:04:38 PDT 2012


On Windows libusb_(attach|detach)_kernel_driver are not supported.
A libusb driver is already installed (device was successfully opened).
In that case just continue as if operation was successful.
---
 usbredirhost/usbredirhost.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 305dd35..3d77ac8 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -486,7 +486,8 @@ static int usbredirhost_claim(struct usbredirhost *host, int initial_claim)
         n = host->config->interface[i].altsetting[0].bInterfaceNumber;

         r = libusb_detach_kernel_driver(host->handle, n);
-        if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND) {
+        if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND
+                  && r != LIBUSB_ERROR_NOT_SUPPORTED) {
             ERROR("could not detach driver from interface %d (configuration %d): %d",
                   n, host->config->bConfigurationValue, r);
             return libusb_status_or_error_to_redir_status(host, r);
@@ -544,6 +545,7 @@ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers)
         r = libusb_attach_kernel_driver(host->handle, n);
         if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND /* No driver */
                   && r != LIBUSB_ERROR_NO_DEVICE /* Device unplugged */
+                  && r != LIBUSB_ERROR_NOT_SUPPORTED /* Not supported */
                   && r != LIBUSB_ERROR_BUSY /* driver rebound already */) {
             ERROR("could not re-attach driver to interface %d (configuration %d): %d",
                   n, host->config->bConfigurationValue, r);
-- 
1.7.7.6



More information about the Spice-devel mailing list