Commit 77550222 authored by Bernhard Nortmann's avatar Bernhard Nortmann Committed by Siarhei Siamashka
Browse files

fel: support updating the caption for "dialog --gauge"



This patch adds an "echo-gauge" command that is intended for use with
sunxi-fel's output piped into the dialog utility. "echo-gauge" will
output its string argument in a way that updates (i.e. overwrites)
the prompt text that dialog displays, so it's possible to change that
inbetween file transfers from sunxi-fel.

Example:
	sunxi-fel uboot ${UBOOT} \
		echo-gauge "Uploading kernel (1/2)" \
		write-with-gauge 0x42000000 ${KERNEL} \
		write 0x43100000 ${SCRIPT} \
		echo-gauge "Uploading rootfs (2/2)" \
		write-with-gauge 0x44000000 ${ROOTFS} \
		| dialog --gauge "" 6 70
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
Reviewed-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent 6712eb84
...@@ -1306,6 +1306,7 @@ int main(int argc, char **argv) ...@@ -1306,6 +1306,7 @@ int main(int argc, char **argv)
" multi[write]-with-gauge ... like their \"write-with-*\" counterpart,\n" " multi[write]-with-gauge ... like their \"write-with-*\" counterpart,\n"
" multi[write]-with-xgauge ... but following the 'multi' syntax:\n" " multi[write]-with-xgauge ... but following the 'multi' syntax:\n"
" <#> addr file [addr file [...]]\n" " <#> addr file [addr file [...]]\n"
" echo-gauge \"some text\" Update prompt/caption for gauge output\n"
" ver[sion] Show BROM version\n" " ver[sion] Show BROM version\n"
" clear address length Clear memory\n" " clear address length Clear memory\n"
" fill address length value Fill memory\n" " fill address length value Fill memory\n"
...@@ -1393,6 +1394,10 @@ int main(int argc, char **argv) ...@@ -1393,6 +1394,10 @@ int main(int argc, char **argv)
size_t count = strtoul(argv[2], NULL, 0); /* file count */ size_t count = strtoul(argv[2], NULL, 0); /* file count */
skip = 2 + 2 * file_upload(handle, count, argc - 3, skip = 2 + 2 * file_upload(handle, count, argc - 3,
argv + 3, progress_gauge_xxx); argv + 3, progress_gauge_xxx);
} else if ((strcmp(argv[1], "echo-gauge") == 0) && argc > 2) {
skip = 2;
printf("XXX\n0\n%s\nXXX\n", argv[2]);
fflush(stdout);
} else if (strcmp(argv[1], "read") == 0 && argc > 4) { } else if (strcmp(argv[1], "read") == 0 && argc > 4) {
size_t size = strtoul(argv[3], NULL, 0); size_t size = strtoul(argv[3], NULL, 0);
void *buf = malloc(size); void *buf = malloc(size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment