Re: [PATCH usbredir] Don't print warning when resetting a missing device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> When usbredirhost clears the current device, it resets the device and
> attempts to re-attach the kernel driver for the device.  The current
> device is cleared when the API user explicitly sets a new device with
> usbredirhost_set_device().  However, some API users call
> usbredirhost_set_device(..., NULL) to clear the current device when the
> redirected device has been unplugged.  In this scenario, resetting the
> device will fail and print a warning to the terminal. Since this is an
> expected scenario, we should simply handle it rather than printing an
> warning.
> 
> Resolves: rhbz#1442963

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

> ---
>  usbredirhost/usbredirhost.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
> index a6bf8b3..3666227 100644
> --- a/usbredirhost/usbredirhost.c
> +++ b/usbredirhost/usbredirhost.c
> @@ -604,7 +604,11 @@ static void usbredirhost_release(struct usbredirhost
> *host, int attach_drivers)
>      if (!(host->quirks & QUIRK_DO_NOT_RESET)) {
>          r = libusb_reset_device(host->handle);
>          if (r != 0) {
> -            ERROR("error resetting device: %s", libusb_error_name(r));
> +            /* if we're releasing the device because it was removed,
> resetting
> +             * will fail. Don't print a warning in this situation */
> +            if (r != LIBUSB_ERROR_NO_DEVICE) {
> +                ERROR("error resetting device: %s", libusb_error_name(r));
> +            }
>              return;
>          }
>      }
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]