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