summaryrefslogtreecommitdiff
path: root/futility/cmd_update.c
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-09-28 19:41:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-02 09:17:11 -0700
commitb95aa03f38d2073e68968145c99a216e4d45084f (patch)
tree03fc1617651ba3ed01999cd750579107cc5da1f0 /futility/cmd_update.c
parentbbe5fda1e8f35bd242ba2e2766a110bada4389e4 (diff)
downloadvboot-b95aa03f38d2073e68968145c99a216e4d45084f.tar.gz
futility: updater: Revise verbosity and error messages
`futility` used to print debug messages to stdout, but there is a side effect that stdout may be buffered and then flush later than stderr. For example, when calling futility via ssh, we will see flashrom messages before any of futility's own messages. Also, many people want to get flashrom verbose messages (-V). With this change, when calling ERROR and DEBUG, we will always output to stderr. This also enables better parameter type checking. `-d` and `-v` both contribute to verbosity, that will be converted to -V's when calling flashrom. BUG=chromium:875551 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I1d22a8054fc43cdc5e6c7415e131cc9826fbff0c Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1251145
Diffstat (limited to 'futility/cmd_update.c')
-rw-r--r--futility/cmd_update.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/futility/cmd_update.c b/futility/cmd_update.c
index c944724a..d220988e 100644
--- a/futility/cmd_update.c
+++ b/futility/cmd_update.c
@@ -78,7 +78,8 @@ static int do_update(int argc, char *argv[])
*opt_emulation = NULL,
*opt_sys_props = NULL,
*opt_write_protection = NULL;
- int opt_is_factory = 0, opt_try_update = 0, opt_force_update = 0;
+ int opt_is_factory = 0, opt_try_update = 0, opt_force_update = 0,
+ opt_verbosity = 0;
int i, errorcnt = 0;
struct updater_config *cfg;
@@ -129,11 +130,11 @@ static int do_update(int argc, char *argv[])
opt_sys_props = optarg;
break;
case 'v':
- /* TODO(hungte) Change to better verbosity control. */
- debugging_enabled = 1;
+ opt_verbosity++;
break;
case 'd':
debugging_enabled = 1;
+ opt_verbosity++;
break;
case 'h':
@@ -164,7 +165,8 @@ static int do_update(int argc, char *argv[])
opt_quirks, opt_mode, opt_programmer,
opt_emulation, opt_sys_props,
opt_write_protection, opt_is_factory,
- opt_try_update, opt_force_update);
+ opt_try_update, opt_force_update,
+ opt_verbosity);
if (!errorcnt) {
int r = update_firmware(cfg);
if (r != UPDATE_ERR_DONE) {