From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: gadget: f_sdp: Provide filesize env variable for downloaded images
Date: Fri, 23 Nov 2018 10:23:45 +0100 [thread overview]
Message-ID: <20181123102345.3b7ec514@jawa> (raw)
In-Reply-To: <1542964884-30204-1-git-send-email-ynezz@true.cz>
On Fri, 23 Nov 2018 10:21:24 +0100
Petr Štetiar <ynezz@true.cz> wrote:
> Currently it's not possible to get filesize of downloaded images and
> it's impossible to automate some tasks in scripts.
>
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Stefan Agner <stefan.agner@toradex.com>
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
> drivers/usb/gadget/f_sdp.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
> index 00a9f88..ae97ab2 100644
> --- a/drivers/usb/gadget/f_sdp.c
> +++ b/drivers/usb/gadget/f_sdp.c
> @@ -100,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;
> @@ -276,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... ",
> @@ -355,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) {
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181123/9cbfd4a0/attachment.sig>
next prev parent reply other threads:[~2018-11-23 9:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 9:21 [U-Boot] [PATCH] usb: gadget: f_sdp: Provide filesize env variable for downloaded images Petr Štetiar
2018-11-23 9:23 ` Lukasz Majewski [this message]
2018-11-23 13:20 ` Marek Vasut
2018-11-23 13:37 ` [U-Boot] [PATCH v2] " Petr Štetiar
2018-11-23 15:52 ` Stefan Agner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181123102345.3b7ec514@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox