mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-30 09:59:03 +02:00
ftdipp_mpsse: don't throw exception when iProduct is empty: display warn and use empty string
This commit is contained in:
@@ -74,10 +74,16 @@ FTDIpp_MPSSE::FTDIpp_MPSSE(const mpsse_bit_config &cable, const string &dev,
|
||||
|
||||
ret = (libusb_error)libusb_get_string_descriptor_ascii(_ftdi->usb_dev,
|
||||
usb_desc.iProduct, _iproduct, 200);
|
||||
/* when FTDI device has no iProduct, libusb return an error
|
||||
* but there is no distinction between
|
||||
* real error and empty field
|
||||
*/
|
||||
if (ret < 0) {
|
||||
snprintf(err, sizeof(err), "unable to get string descriptor: %d %s %s",
|
||||
ret, libusb_error_name(ret), libusb_strerror(ret));
|
||||
throw std::runtime_error(err);
|
||||
snprintf(err, sizeof(err),
|
||||
"Can't read iProduct field from FTDI: "
|
||||
"considered as empty string");
|
||||
printWarn(err);
|
||||
memset(_iproduct,'\0', 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user