summaryrefslogtreecommitdiff
path: root/usbredirhost
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2017-08-10 10:41:57 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2017-08-10 15:08:00 -0500
commit39aa3c69f61bba28856a3eef3fe4ab37a3968e88 (patch)
treea171ad8c2ad6813f784937ece92fb0d348d0533d /usbredirhost
parent0c7db16bc5be3bfc9ee5180d2c7d989eb52e55ec (diff)
Don't print warning when resetting a missing device
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 Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'usbredirhost')
-rw-r--r--usbredirhost/usbredirhost.c6
1 files changed, 5 insertions, 1 deletions
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;
}
}