#include <sys/time.h>
#include <sys/types.h>
#include <libusb.h>
+#include <errno.h>
#include "stlink-common.h"
#include "stlink-usb.h"
} else {
int error = libusb_open(list[cnt], &slu->usb_handle);
if( error !=0 ) {
- WLOG("Error %d opening ST-Link/V2 device %03d:%03d\n", error, libusb_get_bus_number(list[cnt]), libusb_get_device_address(list[cnt]));
+ WLOG("Error %d (%s) opening ST-Link/V2 device %03d:%03d\n",
+ error, strerror (errno), libusb_get_bus_number(list[cnt]), libusb_get_device_address(list[cnt]));
goto on_error;
}
}
if (reset) {
stlink_reset(sl);
}
- stlink_load_device_params(sl);
stlink_version(sl);
-
- error = 0;
+ error = stlink_load_device_params(sl);
on_libusb_error:
if (devs != NULL) {
libusb_exit(slu->libusb_ctx);
if (sl != NULL) free(sl);
if (slu != NULL) free(slu);
- return 0;
+ return NULL;
}