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

Hans de Goede hdegoede at redhat.com
Thu May 3 23:42:58 PDT 2012


Hi,

On 05/03/2012 06:24 PM, Christophe Fergeau wrote:
> 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)

I don't think that will be necessary, not_supported is only returned
when something is not supported by the backend, never as a "normal"
error on backends where some operation is supported.

Regards,

Hans

>
> 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
>>
>>
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list