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 <j.fischer@phytec.de>
This commit is contained in:
Johann Fischer 2017-07-14 11:18:03 +02:00 committed by Anas Nashif
parent 35b34c2e65
commit a8d7659a63
2 changed files with 4 additions and 4 deletions

View file

@ -197,8 +197,8 @@ static const u8_t dfu_mode_usb_description[] = {
USB_CONFIGURATION_DESC_SIZE, /* Descriptor size */ USB_CONFIGURATION_DESC_SIZE, /* Descriptor size */
USB_CONFIGURATION_DESC, /* Descriptor type */ USB_CONFIGURATION_DESC, /* Descriptor type */
/* Total length in bytes of data returned */ /* Total length in bytes of data returned */
LOW_BYTE(DFU_RUNTIME_CONF_SIZE), LOW_BYTE(DFU_MODE_CONF_SIZE),
HIGH_BYTE(DFU_RUNTIME_CONF_SIZE), HIGH_BYTE(DFU_MODE_CONF_SIZE),
DFU_NUM_ITF, /* Number of interfaces */ DFU_NUM_ITF, /* Number of interfaces */
0x01, /* Configuration value */ 0x01, /* Configuration value */
0x00, /* Index of the Configuration string */ 0x00, /* Index of the Configuration string */

View file

@ -116,11 +116,11 @@ enum dfu_state {
* For DFU: CONF + ITF*ALT_SETTINGS + DFU) * For DFU: CONF + ITF*ALT_SETTINGS + DFU)
*/ */
#define DFU_MODE_CONF_SIZE (USB_CONFIGURATION_DESC_SIZE + \ #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) USB_DFU_DESC_SIZE)
#define DFU_RUNTIME_CONF_SIZE (USB_CONFIGURATION_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) USB_DFU_DESC_SIZE)
/* Alternate settings are used to access additional memory segments. /* Alternate settings are used to access additional memory segments.