* [U-Boot] [PATCH v2] usb: gadget: fastboot: improve download progress bar
@ 2014-09-19 6:15 Bo Shen
2014-09-19 7:05 ` Marek Vasut
2014-09-24 12:19 ` Lukasz Majewski
0 siblings, 2 replies; 3+ messages in thread
From: Bo Shen @ 2014-09-19 6:15 UTC (permalink / raw)
To: u-boot
When download is ongoing, if the actual size of one transfer
is not the same as BTYES_PER_DOT, which will cause the dot
won't print anymore. Then it will let the user thinking it
is stuck, actually it is transfering without dot printed.
So, improve the method to show the progress bar (print dot).
Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Changes in v2:
- get rid of the global variable.
- avoid the dot print after showing the total download length.
drivers/usb/gadget/f_fastboot.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 7a1acb9..dda9d1c 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -380,6 +380,7 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
unsigned int transfer_size = download_size - download_bytes;
const unsigned char *buffer = req->buf;
unsigned int buffer_size = req->actual;
+ unsigned int pre_dot_num, now_dot_num;
if (req->status != 0) {
printf("Bad status: %d\n", req->status);
@@ -392,7 +393,15 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
memcpy((void *)CONFIG_USB_FASTBOOT_BUF_ADDR + download_bytes,
buffer, transfer_size);
+ pre_dot_num = download_bytes / BYTES_PER_DOT;
download_bytes += transfer_size;
+ now_dot_num = download_bytes / BYTES_PER_DOT;
+
+ if (pre_dot_num != now_dot_num) {
+ putc('.');
+ if (!(now_dot_num % 74))
+ putc('\n');
+ }
/* Check if transfer is done */
if (download_bytes >= download_size) {
@@ -414,11 +423,6 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
req->length = ep->maxpacket;
}
- if (download_bytes && !(download_bytes % BYTES_PER_DOT)) {
- putc('.');
- if (!(download_bytes % (74 * BYTES_PER_DOT)))
- putc('\n');
- }
req->actual = 0;
usb_ep_queue(ep, req, 0);
}
--
2.1.0.24.g4109c28
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH v2] usb: gadget: fastboot: improve download progress bar
2014-09-19 6:15 [U-Boot] [PATCH v2] usb: gadget: fastboot: improve download progress bar Bo Shen
@ 2014-09-19 7:05 ` Marek Vasut
2014-09-24 12:19 ` Lukasz Majewski
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2014-09-19 7:05 UTC (permalink / raw)
To: u-boot
On Friday, September 19, 2014 at 08:15:12 AM, Bo Shen wrote:
> When download is ongoing, if the actual size of one transfer
> is not the same as BTYES_PER_DOT, which will cause the dot
> won't print anymore. Then it will let the user thinking it
> is stuck, actually it is transfering without dot printed.
>
> So, improve the method to show the progress bar (print dot).
>
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
I didn't test it, but it looks OK:
Acked-by: Marek Vasut <marex@denx.de>
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] usb: gadget: fastboot: improve download progress bar
2014-09-19 6:15 [U-Boot] [PATCH v2] usb: gadget: fastboot: improve download progress bar Bo Shen
2014-09-19 7:05 ` Marek Vasut
@ 2014-09-24 12:19 ` Lukasz Majewski
1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2014-09-24 12:19 UTC (permalink / raw)
To: u-boot
Hi Bo,
> When download is ongoing, if the actual size of one transfer
> is not the same as BTYES_PER_DOT, which will cause the dot
> won't print anymore. Then it will let the user thinking it
> is stuck, actually it is transfering without dot printed.
>
> So, improve the method to show the progress bar (print dot).
Applied to u-boot-dfu tree
Thanks for support!
>
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
> Changes in v2:
> - get rid of the global variable.
> - avoid the dot print after showing the total download length.
>
> drivers/usb/gadget/f_fastboot.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 7a1acb9..dda9d1c 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -380,6 +380,7 @@ static void rx_handler_dl_image(struct usb_ep
> *ep, struct usb_request *req) unsigned int transfer_size =
> download_size - download_bytes; const unsigned char *buffer =
> req->buf; unsigned int buffer_size = req->actual;
> + unsigned int pre_dot_num, now_dot_num;
>
> if (req->status != 0) {
> printf("Bad status: %d\n", req->status);
> @@ -392,7 +393,15 @@ static void rx_handler_dl_image(struct usb_ep
> *ep, struct usb_request *req) memcpy((void
> *)CONFIG_USB_FASTBOOT_BUF_ADDR + download_bytes, buffer,
> transfer_size);
> + pre_dot_num = download_bytes / BYTES_PER_DOT;
> download_bytes += transfer_size;
> + now_dot_num = download_bytes / BYTES_PER_DOT;
> +
> + if (pre_dot_num != now_dot_num) {
> + putc('.');
> + if (!(now_dot_num % 74))
> + putc('\n');
> + }
>
> /* Check if transfer is done */
> if (download_bytes >= download_size) {
> @@ -414,11 +423,6 @@ static void rx_handler_dl_image(struct usb_ep
> *ep, struct usb_request *req) req->length = ep->maxpacket;
> }
>
> - if (download_bytes && !(download_bytes % BYTES_PER_DOT)) {
> - putc('.');
> - if (!(download_bytes % (74 * BYTES_PER_DOT)))
> - putc('\n');
> - }
> req->actual = 0;
> usb_ep_queue(ep, req, 0);
> }
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-24 12:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-19 6:15 [U-Boot] [PATCH v2] usb: gadget: fastboot: improve download progress bar Bo Shen
2014-09-19 7:05 ` Marek Vasut
2014-09-24 12:19 ` Lukasz Majewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox