-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indicate the progress of flashing for better user experience. #75
Conversation
firehose.c
Outdated
@@ -401,6 +403,9 @@ static int firehose_program(struct qdl_device *qdl, struct program *program, int | |||
lseek(fd, (off_t) program->file_offset * program->sector_size, SEEK_SET); | |||
left = num_sectors; | |||
while (left > 0) { | |||
fprintf(stderr, "[PROGRAM] %d sectors remaining out of %d (%.2f%%)\r", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that we didn't want to update this too often, but with the typical 1MB max_payload_size, and if my math is correct, this will generate about 10kb of logs per second on my machine. So, I don't think we need to make this more fancy at this time.
I'm thinking that we should clean up the logs a bit in general. Until then, I like this patch!
But perhaps move it last in the loop? That way it will end at 100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For larger images QDL appear to be stuck without any logs. So updated the patch to limit to 1 log per second. Do check if this is fine.
Add logs to show the partition label currently being flashed and amount of progress as a percentage of completion. Signed-off-by: Viswanath Kraleti <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked you to print at the end of the loop, but that obviously doesn't matter, because you have \r there, so the line will typically be overwritten.
But do we not have a problem with "flashed "%s" successfully" being a shorter string for short values of program->label, resulting in "corrupt" output to the log?
ret = firehose_write(qdl, doc); | ||
if (ret < 0) { | ||
fprintf(stderr, "[PROGRAM] failed to write program command\n"); | ||
fprintf(stderr, "[ERASE] failed to write program command\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good fix, but unrelated.
while (left > 0) { | ||
t = time(NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting that you just do left % N == 0 for some value of N to avoid printing that often, but I guess this works as well...
Please see #88 for a more comprehensive implementation. |
Merged #88 |
Add logs to firehose to show the partition label currently being flashed and progress as a percentage of completion.