Skip to content

Commit

Permalink
cli: Add option [-s | --show-settings-only] to mfg config-set
Browse files Browse the repository at this point in the history
Add this option to decode and display secure settings of a setting file.
No programming will be performed with this option on.
  • Loading branch information
kelvin-cao committed Sep 26, 2023
1 parent fc53dc0 commit a2a45f3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli/mfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ static int config_set(int argc, char **argv)
char *setting_file;
FILE *uds_fimg;
char *uds_file;
int show_only;
int assume_yes;
} cfg = {};
const struct argconfig_options opts[] = {
Expand All @@ -987,6 +988,8 @@ static int config_set(int argc, char **argv)
.value_addr=&cfg.uds_fimg,
.argument_type=required_argument,
.help="UDS file"},
{"show-settings-only", 's', "", CFG_NONE, &cfg.show_only, no_argument,
"Show secure settings without programming"},
{"yes", 'y', "", CFG_NONE, &cfg.assume_yes, no_argument,
"assume yes when prompted"},
{NULL}
Expand Down Expand Up @@ -1054,9 +1057,15 @@ static int config_set(int argc, char **argv)
}
}

printf("Writing the below settings to device: \n");
if (cfg.show_only)
printf("Secure settings for device: \n");
else
printf("Writing the below settings to device: \n");
print_security_cfg_set(&settings);

if (cfg.show_only)
return 0;

if (!cfg.assume_yes)
fprintf(stderr,
"\nWARNING: This operation makes changes to the device OTP memory and is IRREVERSIBLE!\n");
Expand Down

0 comments on commit a2a45f3

Please sign in to comment.