Skip to content

Commit 6b30baf

Browse files
committed
usb: class: dfu: always provide payload_data
Given the device can be enumerated as both legacy and composite, we always need to provide the payload_data buffer. Signed-off-by: Aurelien Jarno <[email protected]>
1 parent 9851ffc commit 6b30baf

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

subsys/usb/class/usb_dfu.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,7 @@ struct dfu_data_t {
291291
/* Number of bytes sent during upload */
292292
u32_t bytes_sent;
293293
u32_t alt_setting; /* DFU alternate setting */
294-
#ifdef CONFIG_USB_COMPOSITE_DEVICE
295-
u8_t *buffer;
296-
#else
297294
u8_t buffer[USB_DFU_MAX_XFER_SIZE]; /* DFU data buffer */
298-
#endif
299295
struct flash_img_context ctx;
300296
enum dfu_state state; /* State of the DFU device */
301297
enum dfu_status status; /* Status of the DFU device */
@@ -683,7 +679,7 @@ USBD_CFG_DATA_DEFINE(dfu) struct usb_cfg_data dfu_config = {
683679
.interface = {
684680
.class_handler = dfu_class_handle_req,
685681
.custom_handler = dfu_custom_handle_req,
686-
.payload_data = NULL,
682+
.payload_data = dfu_data.buffer,
687683
},
688684
.num_endpoints = 0,
689685
};
@@ -700,7 +696,7 @@ USBD_CFG_DATA_DEFINE(dfu_mode) struct usb_cfg_data dfu_mode_config = {
700696
.interface = {
701697
.class_handler = dfu_class_handle_req,
702698
.custom_handler = dfu_custom_handle_req,
703-
.payload_data = NULL,
699+
.payload_data = dfu_data.buffer,
704700
},
705701
.num_endpoints = 0,
706702
};
@@ -745,7 +741,6 @@ static int usb_dfu_init(struct device *dev)
745741
k_work_init(&dfu_work, dfu_work_handler);
746742

747743
#ifndef CONFIG_USB_COMPOSITE_DEVICE
748-
dfu_config.interface.payload_data = dfu_data.buffer;
749744
dfu_config.usb_device_description = usb_get_device_descriptor();
750745

751746
/* Initialize the USB driver with the right configuration */

0 commit comments

Comments
 (0)