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