Skip to content

Commit d846786

Browse files
committed
hosted/CMSIS-DAP: Do not discard devices with optional SWO endpoint
1 parent 221c303 commit d846786

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/platforms/hosted/bmp_libusb.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,12 @@ static void check_cmsis_interface_type(libusb_device *const device, bmda_probe_s
473473
for (uint8_t index = 0; index < descriptor->bNumEndpoints; ++index)
474474
info->max_packet_length = MIN(descriptor->endpoint[index].wMaxPacketSize, info->max_packet_length);
475475

476-
/* Check if it's a CMSIS-DAP v2 interface */
477-
if (descriptor->bInterfaceClass == 0xffU && descriptor->bNumEndpoints == 2U) {
476+
/* Check if it's a CMSIS-DAP v2 interface. */
477+
if (descriptor->bInterfaceClass == 0xffU &&
478+
(descriptor->bNumEndpoints == 2U || descriptor->bNumEndpoints == 3U)) {
478479
info->interface_num = descriptor->bInterfaceNumber;
479-
/* Extract the endpoints required */
480-
for (uint8_t index = 0; index < descriptor->bNumEndpoints; ++index) {
480+
/* Extract the endpoints required. Ignore optional SWO trace endpoint */
481+
for (uint8_t index = 0; index < 2U; ++index) {
481482
const uint8_t ep = descriptor->endpoint[index].bEndpointAddress;
482483
if (ep & 0x80U)
483484
info->in_ep = ep;

0 commit comments

Comments
 (0)