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: Bernhard Nortmann <bernhard.nortm...@web.de>
---
 fel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fel.c b/fel.c
index 2e948fd..c4bf80f 100644
--- a/fel.c
+++ b/fel.c
@@ -1429,6 +1429,10 @@ int main(int argc, char **argv)
 
                                skip += count * 2;
                        }
+               } 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) {
                        size_t size = strtoul(argv[3], NULL, 0);
                        void *buf = malloc(size);
-- 
2.4.6

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to