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

fel: implement "write-with-progress" and "multiwrite"



The two new commands both imply that a (simple) progress bar
display is requested. "multi[write]" allows to upload a group
of files with a single command, resulting in their transfer
showing a common, 'overall' progress status.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
Acked-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent b3c02a0a
...@@ -1298,6 +1298,9 @@ int main(int argc, char **argv) ...@@ -1298,6 +1298,9 @@ int main(int argc, char **argv)
" exe[cute] address Call function address\n" " exe[cute] address Call function address\n"
" read address length file Write memory contents into file\n" " read address length file Write memory contents into file\n"
" write address file Store file contents into memory\n" " write address file Store file contents into memory\n"
" write-with-progress addr file \"write\" with progress bar\n"
" multi[write] # addr file ... \"write-with-progress\" multiple files,\n"
" sharing a common progress status\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"
...@@ -1361,6 +1364,14 @@ int main(int argc, char **argv) ...@@ -1361,6 +1364,14 @@ int main(int argc, char **argv)
} else if (strcmp(argv[1], "write") == 0 && argc > 3) { } else if (strcmp(argv[1], "write") == 0 && argc > 3) {
skip += 2 * file_upload(handle, 1, argc - 2, argv + 2, skip += 2 * file_upload(handle, 1, argc - 2, argv + 2,
pflag_active ? progress_bar : NULL); pflag_active ? progress_bar : NULL);
} else if (strcmp(argv[1], "write-with-progress") == 0 && argc > 3) {
skip += 2 * file_upload(handle, 1, argc - 2, argv + 2,
progress_bar);
} else if ((strcmp(argv[1], "multiwrite") == 0 ||
strcmp(argv[1], "multi") == 0) && argc > 4) {
size_t count = strtoul(argv[2], NULL, 0); /* file count */
skip = 2 + 2 * file_upload(handle, count, argc - 3,
argv + 3, progress_bar);
} 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