Blame SOURCES/0002-Don-t-print-warning-when-resetting-a-missing-device.patch

9f8f3a
From 39aa3c69f61bba28856a3eef3fe4ab37a3968e88 Mon Sep 17 00:00:00 2001
9f8f3a
From: Jonathon Jongsma <jjongsma@redhat.com>
9f8f3a
Date: Thu, 10 Aug 2017 10:41:57 -0500
9f8f3a
Subject: [PATCH usbredir] Don't print warning when resetting a missing device
9f8f3a
9f8f3a
When usbredirhost clears the current device, it resets the device and
9f8f3a
attempts to re-attach the kernel driver for the device.  The current
9f8f3a
device is cleared when the API user explicitly sets a new device with
9f8f3a
usbredirhost_set_device().  However, some API users call
9f8f3a
usbredirhost_set_device(..., NULL) to clear the current device when the
9f8f3a
redirected device has been unplugged.  In this scenario, resetting the
9f8f3a
device will fail and print a warning to the terminal. Since this is an
9f8f3a
expected scenario, we should simply handle it rather than printing an
9f8f3a
warning.
9f8f3a
9f8f3a
Resolves: rhbz#1442963
9f8f3a
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
9f8f3a
Acked-by: Frediano Ziglio <fziglio@redhat.com>
9f8f3a
---
9f8f3a
 usbredirhost/usbredirhost.c | 6 +++++-
9f8f3a
 1 file changed, 5 insertions(+), 1 deletion(-)
9f8f3a
9f8f3a
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
9f8f3a
index a6bf8b3..3666227 100644
9f8f3a
--- a/usbredirhost/usbredirhost.c
9f8f3a
+++ b/usbredirhost/usbredirhost.c
9f8f3a
@@ -604,7 +604,11 @@ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers)
9f8f3a
     if (!(host->quirks & QUIRK_DO_NOT_RESET)) {
9f8f3a
         r = libusb_reset_device(host->handle);
9f8f3a
         if (r != 0) {
9f8f3a
-            ERROR("error resetting device: %s", libusb_error_name(r));
9f8f3a
+            /* if we're releasing the device because it was removed, resetting
9f8f3a
+             * will fail. Don't print a warning in this situation */
9f8f3a
+            if (r != LIBUSB_ERROR_NO_DEVICE) {
9f8f3a
+                ERROR("error resetting device: %s", libusb_error_name(r));
9f8f3a
+            }
9f8f3a
             return;
9f8f3a
         }
9f8f3a
     }
9f8f3a
-- 
9f8f3a
2.13.6
9f8f3a