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