From a8d7659a63659c3a5c16bfcf5b82d25668e5955d Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 14 Jul 2017 11:18:03 +0200 Subject: [PATCH] samples: dfu: fix usb configuration descriptor length The macros for calculating the length of the configuration descriptors have been interchanged, fix it, and use the correct macro for the length of the DFU mode configuration descriptor. Signed-off-by: Johann Fischer --- samples/subsys/usb/dfu/src/usb_dfu.c | 4 ++-- samples/subsys/usb/dfu/src/usb_dfu.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/subsys/usb/dfu/src/usb_dfu.c b/samples/subsys/usb/dfu/src/usb_dfu.c index 68f7e5b2cc..744415ad67 100644 --- a/samples/subsys/usb/dfu/src/usb_dfu.c +++ b/samples/subsys/usb/dfu/src/usb_dfu.c @@ -197,8 +197,8 @@ static const u8_t dfu_mode_usb_description[] = { USB_CONFIGURATION_DESC_SIZE, /* Descriptor size */ USB_CONFIGURATION_DESC, /* Descriptor type */ /* Total length in bytes of data returned */ - LOW_BYTE(DFU_RUNTIME_CONF_SIZE), - HIGH_BYTE(DFU_RUNTIME_CONF_SIZE), + LOW_BYTE(DFU_MODE_CONF_SIZE), + HIGH_BYTE(DFU_MODE_CONF_SIZE), DFU_NUM_ITF, /* Number of interfaces */ 0x01, /* Configuration value */ 0x00, /* Index of the Configuration string */ diff --git a/samples/subsys/usb/dfu/src/usb_dfu.h b/samples/subsys/usb/dfu/src/usb_dfu.h index b17e5a0fc0..cb11764d30 100644 --- a/samples/subsys/usb/dfu/src/usb_dfu.h +++ b/samples/subsys/usb/dfu/src/usb_dfu.h @@ -116,11 +116,11 @@ enum dfu_state { * For DFU: CONF + ITF*ALT_SETTINGS + DFU) */ #define DFU_MODE_CONF_SIZE (USB_CONFIGURATION_DESC_SIZE + \ - USB_INTERFACE_DESC_SIZE * DFU_RUNTIME_ALTERNATE_SETTINGS + \ + USB_INTERFACE_DESC_SIZE * DFU_MODE_ALTERNATE_SETTINGS + \ USB_DFU_DESC_SIZE) #define DFU_RUNTIME_CONF_SIZE (USB_CONFIGURATION_DESC_SIZE + \ - USB_INTERFACE_DESC_SIZE * DFU_MODE_ALTERNATE_SETTINGS + \ + USB_INTERFACE_DESC_SIZE * DFU_RUNTIME_ALTERNATE_SETTINGS + \ USB_DFU_DESC_SIZE) /* Alternate settings are used to access additional memory segments.