+ /* We can rely on the interface is really CMSIS-DAP if
+ * - we've seen CMSIS-DAP in the interface string
+ * - config asked explicitly for an interface number
+ * - the device has only one interface
+ * The later two cases should be honored only if we know
+ * we are on the rigt device */
+ bool intf_identified_reliably = cmsis_dap_in_interface_str
+ || (device_identified_reliably &&
+ (cmsis_dap_usb_interface != -1
+ || config_desc->bNumInterfaces == 1));
+
+ if (intf_desc->bInterfaceClass != LIBUSB_CLASS_VENDOR_SPEC ||
+ intf_desc->bInterfaceSubClass != 0 || intf_desc->bInterfaceProtocol != 0) {
+ /* If the interface is reliably identified
+ * then we need not insist on setting USB class, subclass and protocol
+ * exactly as the specification requires.
+ * At least KitProg3 uses class 0 contrary to the specification */
+ if (intf_identified_reliably) {
+ LOG_WARNING("Using CMSIS-DAPv2 interface %d with wrong class %" PRId8
+ " subclass %" PRId8 " or protocol %" PRId8,
+ interface_num,
+ intf_desc->bInterfaceClass,
+ intf_desc->bInterfaceSubClass,
+ intf_desc->bInterfaceProtocol);
+ } else {
+ LOG_DEBUG("skipping interface %d, class %" PRId8
+ " subclass %" PRId8 " protocol %" PRId8,
+ interface_num,
+ intf_desc->bInterfaceClass,
+ intf_desc->bInterfaceSubClass,
+ intf_desc->bInterfaceProtocol);