* [U-Boot] [PATCH] usb: gadget: f_sdp: Provide filesize env variable for downloaded images
@ 2018-11-23 9:21 Petr Štetiar
2018-11-23 9:23 ` Lukasz Majewski
2018-11-23 13:20 ` Marek Vasut
0 siblings, 2 replies; 5+ messages in thread
From: Petr Štetiar @ 2018-11-23 9:21 UTC (permalink / raw)
To: u-boot
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) {
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] usb: gadget: f_sdp: Provide filesize env variable for downloaded images
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
2018-11-23 13:20 ` Marek Vasut
1 sibling, 0 replies; 5+ messages in thread
From: Lukasz Majewski @ 2018-11-23 9:23 UTC (permalink / raw)
To: u-boot
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] usb: gadget: f_sdp: Provide filesize env variable for downloaded images
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
@ 2018-11-23 13:20 ` Marek Vasut
2018-11-23 13:37 ` [U-Boot] [PATCH v2] " Petr Štetiar
1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2018-11-23 13:20 UTC (permalink / raw)
To: u-boot
On 11/23/2018 10:21 AM, Petr Štetiar wrote:
> Currently it's not possible to get filesize of downloaded images and
> it's impossible to automate some tasks in scripts.
... so ... what does this patch do about it ? That sort of thing should
be in the commit message.
> 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) {
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2] usb: gadget: f_sdp: Provide filesize env variable for downloaded images
2018-11-23 13:20 ` Marek Vasut
@ 2018-11-23 13:37 ` Petr Štetiar
2018-11-23 15:52 ` Stefan Agner
0 siblings, 1 reply; 5+ messages in thread
From: Petr Štetiar @ 2018-11-23 13:37 UTC (permalink / raw)
To: u-boot
Currently it's not possible to get filesize of downloaded images and
it's impossible to automate some tasks in scripts. So this patch adds
`filesize` environment variable with size (as hex number in bytes) of
the last successfully downloaded file via `sdp` command.
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>
---
Changes since v1:
* added more details to the commit message
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) {
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2] usb: gadget: f_sdp: Provide filesize env variable for downloaded images
2018-11-23 13:37 ` [U-Boot] [PATCH v2] " Petr Štetiar
@ 2018-11-23 15:52 ` Stefan Agner
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Agner @ 2018-11-23 15:52 UTC (permalink / raw)
To: u-boot
On 23.11.18 14:37, Petr Štetiar wrote:
> Currently it's not possible to get filesize of downloaded images and
> it's impossible to automate some tasks in scripts. So this patch adds
> `filesize` environment variable with size (as hex number in bytes) of
> the last successfully downloaded file via `sdp` command.
Nice addition!
Looks good to me:
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
--
Stefan
>
> 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>
> ---
>
> Changes since v1:
> * added more details to the commit message
>
> 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) {
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-23 15:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.