common: don't retry the interface claiming if it's not a BUSY error.

And don't try to urlencode a serial number that we know was bogus.
This commit is contained in:
Solomon Peachy 2016-10-26 17:15:27 -04:00
parent 6cdd326eca
commit 1f034a8a40
1 changed files with 4 additions and 2 deletions

View File

@ -27,7 +27,7 @@
#include "backend_common.h"
#define BACKEND_VERSION "0.67"
#define BACKEND_VERSION "0.68"
#ifndef URI_PREFIX
#error "Must Define URI_PREFIX"
#endif
@ -52,6 +52,8 @@ static int backend_claim_interface(struct libusb_device_handle *dev, int iface)
ret = libusb_claim_interface(dev, iface);
if (!ret)
break;
if (ret != LIBUSB_ERROR_BUSY)
break;
sleep(1);
} while (--attempts > 0);
@ -485,8 +487,8 @@ static int print_scan_output(struct libusb_device *device,
/* Ignore result since a failure isn't critical here */
backend->query_serno(dev, endp_up, endp_down, buf, STR_LEN_MAX);
libusb_release_interface(dev, iface);
serial = url_encode(buf);
}
serial = url_encode(buf);
if (config)
libusb_free_config_descriptor(config);