diff --git a/atusb/fw/descr.c b/atusb/fw/descr.c index 56447ff..f96b0ee 100644 --- a/atusb/fw/descr.c +++ b/atusb/fw/descr.c @@ -100,5 +100,5 @@ const uint8_t config_descriptor[] = { /* Interface #1 */ - DFU_ITF_DESCR(1, 0, dfu_proto_runtime) + DFU_ITF_DESCR(1, 0, dfu_proto_runtime, 0) }; diff --git a/atusb/fw/usb/dfu.c b/atusb/fw/usb/dfu.c index 723221c..b15891c 100644 --- a/atusb/fw/usb/dfu.c +++ b/atusb/fw/usb/dfu.c @@ -46,6 +46,18 @@ #define DFU_ALT_SETTINGS 1 #endif +#ifndef DFU_ALT_NAME_0_IDX +#define DFU_ALT_NAME_0_IDX 0 +#endif + +#ifndef DFU_ALT_NAME_1_IDX +#define DFU_ALT_NAME_1_IDX 0 +#endif + +#ifndef DFU_ALT_NAME_2_IDX +#define DFU_ALT_NAME_2_IDX 0 +#endif + const uint8_t device_descriptor[] = { 18, /* bLength */ @@ -82,12 +94,12 @@ const uint8_t config_descriptor[] = { /* Interface #0 */ - DFU_ITF_DESCR(0, 0, dfu_proto_dfu) + DFU_ITF_DESCR(0, 0, dfu_proto_dfu, DFU_ALT_NAME_0_IDX) #if DFU_ALT_SETTINGS >= 1 - DFU_ITF_DESCR(0, 1, dfu_proto_dfu) + DFU_ITF_DESCR(0, 1, dfu_proto_dfu, DFU_ALT_NAME_1_IDX) #endif #if DFU_ALT_SETTINGS >= 2 - DFU_ITF_DESCR(0, 2, dfu_proto_dfu) + DFU_ITF_DESCR(0, 2, dfu_proto_dfu, DFU_ALT_NAME_2_IDX) #endif }; diff --git a/atusb/fw/usb/dfu.h b/atusb/fw/usb/dfu.h index b77758f..9637af2 100644 --- a/atusb/fw/usb/dfu.h +++ b/atusb/fw/usb/dfu.h @@ -86,7 +86,7 @@ struct dfu { }; -#define DFU_ITF_DESCR(itf, alt, proto) \ +#define DFU_ITF_DESCR(itf, alt, proto, idx) \ 9, /* bLength */ \ USB_DT_INTERFACE, /* bDescriptorType */ \ (itf), /* bInterfaceNumber */ \ @@ -95,7 +95,7 @@ struct dfu { 0xfe, /* bInterfaceClass (application specific) */ \ 0x01, /* bInterfaceSubClass (device fw upgrade) */ \ (proto), /* bInterfaceProtocol (dfu_proto_*) */ \ - 0, /* iInterface */ + (idx), /* iInterface */ struct dfu_flash_ops {