Skip to content

Commit

Permalink
hosted/cmsis_dap: Use the new option to retry HID interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ALTracer committed Sep 29, 2024
1 parent cece044 commit 4ea5281
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/platforms/hosted/cmsis_dap.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,18 @@ bool dap_init(bool allow_fallback)
type = CMSIS_TYPE_HID;

/* Windows hosts may not have the winusb driver associated with v2, handle that by degrading to v1 */
if (type == CMSIS_TYPE_BULK) {
if (!dap_init_bulk()) {
if (type == CMSIS_TYPE_BULK && !dap_init_bulk()) {
if (allow_fallback) {
DEBUG_WARN("Could not setup a CMSIS-DAP v2 device in Bulk mode (no drivers?), retrying HID mode\n");
type = CMSIS_TYPE_HID;
} else {
DEBUG_ERROR("Could not setup a CMSIS-DAP device over Bulk interface, failing. Hint: pass %s to retry "
"HID interface\n",
"--allow-fallback");
return false;
}
}

if (type == CMSIS_TYPE_HID) {
if (!dap_init_hid())
return false;
Expand Down

0 comments on commit 4ea5281

Please sign in to comment.