dfu: when libusb_open fails: skip device instead of error and stop
This commit is contained in:
parent
35efeb3eee
commit
310d21ebf5
15
src/dfu.cpp
15
src/dfu.cpp
|
|
@ -305,19 +305,18 @@ int DFU::searchDFUDevices()
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
char mess[256];
|
char mess[256];
|
||||||
sprintf(mess,"Unable to open device: "
|
sprintf(mess,"Unable to open device: "
|
||||||
"%04x:%04x (bus %d, device %2d) Error: %s\n",
|
"%04x:%04x (bus %d, device %2d) Error: %s -> skip\n",
|
||||||
desc.idVendor, desc.idProduct,
|
desc.idVendor, desc.idProduct,
|
||||||
libusb_get_bus_number(usb_dev),
|
libusb_get_bus_number(usb_dev),
|
||||||
libusb_get_device_address(usb_dev),
|
libusb_get_device_address(usb_dev),
|
||||||
libusb_error_name(ret));
|
libusb_error_name(ret));
|
||||||
printError(mess);
|
printWarn(mess);
|
||||||
return EXIT_FAILURE;
|
} else {
|
||||||
|
if (searchIfDFU(handle, usb_dev, &desc) != 0) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
libusb_close(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchIfDFU(handle, usb_dev, &desc) != 0) {
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
libusb_close(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_free_device_list(dev_list, 1);
|
libusb_free_device_list(dev_list, 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue