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

Christophe Fergeau cfergeau at redhat.com
Thu May 3 09:24:52 PDT 2012


On Thu, May 03, 2012 at 06:04:38PM +0300, Uri Lublin wrote:
> 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.

Do we want to only do that check on Windows in case this indicates real
issues on other systems? (BSDs for example)

Christophe

> ---
>  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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120503/e1e87bb9/attachment.pgp>


More information about the Spice-devel mailing list