From d6e84be79c8bb4d1a4ab768f0530a7bf5fbd3f25 Mon Sep 17 00:00:00 2001 From: ALTracer <11005378+ALTracer@users.noreply.github.com> Date: Sun, 29 Sep 2024 22:20:41 +0300 Subject: [PATCH] fixup! hosted/cmsis_dap: Use the new option to retry HID interface --- src/platforms/hosted/cmsis_dap.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/platforms/hosted/cmsis_dap.c b/src/platforms/hosted/cmsis_dap.c index 9e07155aef6..5af4686e55c 100644 --- a/src/platforms/hosted/cmsis_dap.c +++ b/src/platforms/hosted/cmsis_dap.c @@ -271,19 +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 (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_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;