summaryrefslogtreecommitdiff
path: root/firmware/src/dfu
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/src/dfu')
-rw-r--r--firmware/src/dfu/dfu.c12
-rw-r--r--firmware/src/dfu/dfu.h27
2 files changed, 39 insertions, 0 deletions
diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c
index dc97624..f5abe46 100644
--- a/firmware/src/dfu/dfu.c
+++ b/firmware/src/dfu/dfu.c
@@ -569,7 +569,11 @@ __dfustruct const struct _dfu_desc dfu_cfg_descriptor = {
USB_DT_DFU_SIZE,
.bNumInterfaces = 1,
.bConfigurationValue = 1,
+#ifdef CONFIG_USB_STRING
.iConfiguration = 3,
+#else
+ .iConfiguration = 0,
+#endif
.bmAttributes = USB_CONFIG_ATT_ONE,
.bMaxPower = 100,
},
@@ -582,7 +586,11 @@ __dfustruct const struct _dfu_desc dfu_cfg_descriptor = {
.bInterfaceClass = 0xfe,
.bInterfaceSubClass = 0x01,
.bInterfaceProtocol = 0x02,
+#ifdef CONFIG_USB_STRING
.iInterface = 4,
+#else
+ .iInterface = 0,
+#endif
},
.uif[1] = {
.bLength = USB_DT_INTERFACE_SIZE,
@@ -593,7 +601,11 @@ __dfustruct const struct _dfu_desc dfu_cfg_descriptor = {
.bInterfaceClass = 0xfe,
.bInterfaceSubClass = 0x01,
.bInterfaceProtocol = 0x02,
+#ifdef CONFIG_USB_STRING
.iInterface = 5,
+#else
+ .iInterface = 0,
+#endif
},
.func_dfu = DFU_FUNC_DESC,
diff --git a/firmware/src/dfu/dfu.h b/firmware/src/dfu/dfu.h
index 084883b..a4184b4 100644
--- a/firmware/src/dfu/dfu.h
+++ b/firmware/src/dfu/dfu.h
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <usb_ch9.h>
#include <usb_dfu.h>
+#include "../config.h"
/* USB DFU functional descriptor */
#define DFU_FUNC_DESC { \
@@ -38,6 +39,7 @@
}
/* USB Interface descriptor in Runtime mode */
+#ifdef CONFIG_USB_STRING
#define DFU_RT_IF_DESC { \
{ \
.bLength = USB_DT_INTERFACE_SIZE, \
@@ -61,6 +63,31 @@
.iInterface = 2, \
}, \
}
+#else
+#define DFU_RT_IF_DESC { \
+ { \
+ .bLength = USB_DT_INTERFACE_SIZE, \
+ .bDescriptorType = USB_DT_INTERFACE, \
+ .bInterfaceNumber = 0x01, \
+ .bAlternateSetting = 0x00, \
+ .bNumEndpoints = 0x00, \
+ .bInterfaceClass = 0xfe, \
+ .bInterfaceSubClass = 0x01, \
+ .bInterfaceProtocol = 0x01, \
+ .iInterface = 0, \
+ }, { \
+ .bLength = USB_DT_INTERFACE_SIZE, \
+ .bDescriptorType = USB_DT_INTERFACE, \
+ .bInterfaceNumber = 0x02, \
+ .bAlternateSetting = 0x00, \
+ .bNumEndpoints = 0x00, \
+ .bInterfaceClass = 0xfe, \
+ .bInterfaceSubClass = 0x01, \
+ .bInterfaceProtocol = 0x01, \
+ .iInterface = 0, \
+ }, \
+}
+#endif
#define __dfufunctab __attribute__ ((section (".dfu.functab")))
#define __dfudata __attribute__ ((section (".data.shared")))
personal git repositories of Harald Welte. Your mileage may vary