summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2016-12-08 18:10:49 +0100
committerMarek Vasut <marex@denx.de>2017-02-26 13:24:30 +0100
commit8987012fe5a8bc226d1b3f5187c152b8d85a2dcd (patch)
tree7ba71d89b6c889ed5b514ed1edfae90a66e1082a /drivers/usb
parent282b72082f68254edd9631c8c04354e0fb63c2f6 (diff)
downloadu-boot-8987012fe5a8bc226d1b3f5187c152b8d85a2dcd.tar.gz
u-boot-8987012fe5a8bc226d1b3f5187c152b8d85a2dcd.tar.bz2
u-boot-8987012fe5a8bc226d1b3f5187c152b8d85a2dcd.zip
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: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_dfu.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 8e7c981657..73b32f8ae5 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -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));
+
+ i++;
f_dfu->function[i] = NULL;
return 0;