aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jtag/drivers/cmsis_dap_usb.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index 34f8f251..dc59fcf9 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -173,13 +173,18 @@ static int cmsis_dap_usb_open(void)
devs = hid_enumerate(0x0, 0x0);
cur_dev = devs;
while (NULL != cur_dev) {
- if ((0 == cmsis_dap_vid[0]) && (NULL != cur_dev->product_string)
- && wcsstr(cur_dev->product_string, L"CMSIS-DAP")) {
- /*
- if the user hasn't specified VID:PID *and*
- product string contains "CMSIS-DAP", pick it
- */
- break;
+ if (0 == cmsis_dap_vid[0]) {
+ if (NULL == cur_dev->product_string) {
+ LOG_DEBUG("Cannot read product string of device 0x%x:0x%x",
+ cur_dev->vendor_id, cur_dev->product_id);
+ } else {
+ if (wcsstr(cur_dev->product_string, L"CMSIS-DAP"))
+ /*
+ if the user hasn't specified VID:PID *and*
+ product string contains "CMSIS-DAP", pick it
+ */
+ break;
+ }
} else {
/*
otherwise, exhaustively compare against all VID:PID in list