Commit 8987012f authored by Patrick Delaunay's avatar Patrick Delaunay Committed by Marek Vasut

usb: gadget: dfu: add functional descriptor in descriptor set

The "DFU descriptor set" must contain the "DFU functional descriptor"
but it is missing today in U-Boot code
(cf: DFU spec 1.1, chapter 4.2 DFU Mode Descriptor Set)
This patch only allocate buffer and copy DFU functional descriptor
after interfaces.
Signed-off-by: default avatarPatrick Delaunay <>
Signed-off-by: default avatarPatrick Delaunay <>
parent 282b7208
......@@ -654,7 +654,7 @@ static int dfu_prepare_function(struct f_dfu *f_dfu, int n)
struct usb_interface_descriptor *d;
int i = 0;
f_dfu->function = calloc(sizeof(struct usb_descriptor_header *), n + 1);
f_dfu->function = calloc(sizeof(struct usb_descriptor_header *), n + 2);
if (!f_dfu->function)
goto enomem;
......@@ -673,6 +673,14 @@ static int dfu_prepare_function(struct f_dfu *f_dfu, int n)
f_dfu->function[i] = (struct usb_descriptor_header *)d;
/* add DFU Functional Descriptor */
f_dfu->function[i] = calloc(sizeof(dfu_func), 1);
if (!f_dfu->function[i])
goto enomem;
memcpy(f_dfu->function[i], &dfu_func, sizeof(dfu_func));
f_dfu->function[i] = NULL;
return 0;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment