X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fusb%2Fgadget%2Ff_sdp.c;h=ae97ab2b497399ae8840fb12327b7f61c6581736;hb=cf8dcc5d02c32173b74bf1b7600dd2b990a90b13;hp=43c5cfbb77a8a0e1ef66c978eb6d54629ba20d56;hpb=a64a614db70f1c758aea0a1620c4fcd49e037d47;p=oweals%2Fu-boot.git diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 43c5cfbb77..ae97ab2b49 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * f_sdp.c -- USB HID Serial Download Protocol * @@ -13,8 +14,6 @@ * SKIP_DCD_HEADER are only stubs. * * Parts of the implementation are based on f_dfu and f_thor. - * - * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -101,6 +100,7 @@ struct f_sdp { enum sdp_state state; enum sdp_state next_state; u32 dnl_address; + u32 dnl_bytes; u32 dnl_bytes_remaining; u32 jmp_address; bool always_send_status; @@ -277,6 +277,7 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) sdp->state = SDP_STATE_RX_FILE_DATA; sdp->dnl_address = be32_to_cpu(cmd->addr); sdp->dnl_bytes_remaining = be32_to_cpu(cmd->cnt); + sdp->dnl_bytes = sdp->dnl_bytes_remaining; sdp->next_state = SDP_STATE_IDLE; printf("Downloading file of size %d to 0x%08x... ", @@ -356,6 +357,9 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req) if (sdp->dnl_bytes_remaining) return; +#ifndef CONFIG_SPL_BUILD + env_set_hex("filesize", sdp->dnl_bytes); +#endif printf("done\n"); switch (sdp->state) {