summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-11-19 13:56:55 +0100
committerHans de Goede <hdegoede@redhat.com>2013-11-19 13:56:55 +0100
commitb5cf2a7eb35c2396686a3eb73c4ddd932d2e4b8c (patch)
tree56a77f5d3a98f8e814cfb7ffe1f6fc2042eea358
parent6b7642032247eca4cb25200f1591ccc9bb71f616 (diff)
usbredirhost: reset device on release
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--usbredirhost/usbredirhost.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index dcb0940..bbaafa4 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -591,6 +591,16 @@ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers)
host->claimed = 0;
+ /* reset the device before re-binding the kernel drivers, so that the
+ kernel drivers get the device in a clean state. */
+ 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));
+ return;
+ }
+ }
+
if (host->config)
current_config = host->config->bConfigurationValue;