Skip to content

Commit 733a44a

Browse files
committed
qdl: improve usage output
Prettify usage details and introduce explicit -h param: Usage: qdl [options] <prog.mbn> [<program> <patch> ...] -d, --debug Print detailed debug info -v, --version Print the current version and exit -n, --dry-run Dry run execution, no device reading or flashing -f, --allow-missing Allow skipping of missing files during flashing -s, --storage=T Set target storage type T: <emmc|nand|ufs> -l, --finalize-provisioning Provision the target storage -i, --include=T Set an optional folder T to search for files -S, --serial=T Select target by serial number T (e.g. <0AA94EFD>) -u, --out-chunk-size=T Override chunk size for transaction with T -t, --create-digests=T Generate table of digests in the T folder -D, --vip-table-path=T Use digest tables in the T folder for VIP -h, --help Print this usage info Example: qdl prog_firehose_ddr.elf rawprogram*.xml patch*.xml Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
1 parent 1bbbdb6 commit 733a44a

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

qdl.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,27 @@ static int detect_type(const char *xml_file)
7979
return type;
8080
}
8181

82-
static void print_usage(void)
82+
static void print_usage(FILE *out)
8383
{
8484
extern const char *__progname;
8585

86-
fprintf(stderr,
87-
"%s [--debug] [--dry-run] [--version] [--allow-missing] [--storage <emmc|nand|ufs>] [--finalize-provisioning] [--include <PATH>] [--serial <NUM>] [--out-chunk-size <SIZE>] [--create-digests <PATH>] [--vip_table_path <PATH>] <prog.mbn> [<program> <patch> ...]\n",
88-
__progname);
86+
fprintf(out, "Usage: %s [options] <prog.mbn> [<program> <patch> ...]\n", __progname);
87+
fprintf(out, " -d, --debug\t\t\tPrint detailed debug info\n");
88+
fprintf(out, " -v, --version\t\t\tPrint the current version and exit\n");
89+
fprintf(out, " -n, --dry-run\t\t\tDry run execution, no device reading or flashing\n");
90+
fprintf(out, " -f, --allow-missing\t\tAllow skipping of missing files during flashing\n");
91+
fprintf(out, " -s, --storage=T\t\tSet target storage type T: <emmc|nand|ufs>\n");
92+
fprintf(out, " -l, --finalize-provisioning\tProvision the target storage\n");
93+
fprintf(out, " -i, --include=T\t\tSet an optional folder T to search for files\n");
94+
fprintf(out, " -S, --serial=T\t\t\tSelect target by serial number T (e.g. <0AA94EFD>)\n");
95+
fprintf(out, " -u, --out-chunk-size=T\t\tOverride chunk size for transaction with T\n");
96+
fprintf(out, " -t, --create-digests=T\t\tGenerate table of digests in the T folder\n");
97+
fprintf(out, " -D, --vip-table-path=T\t\tUse digest tables in the T folder for VIP\n");
98+
fprintf(out, " -h, --help\t\t\tPrint this usage info\n");
99+
fprintf(out, "\n");
100+
fprintf(out, "Example: %s prog_firehose_ddr.elf rawprogram*.xml patch*.xml\n", __progname);
89101
}
90102

91-
92103
int main(int argc, char **argv)
93104
{
94105
char *prog_mbn, *storage = "ufs";
@@ -119,6 +130,7 @@ int main(int argc, char **argv)
119130
{"allow-fusing", no_argument, 0, 'c'},
120131
{"dry-run", no_argument, 0, 'n'},
121132
{"create-digests", required_argument, 0, 't'},
133+
{"help", no_argument, 0, 'h'},
122134
{0, 0, 0, 0}
123135
};
124136

@@ -162,15 +174,18 @@ int main(int argc, char **argv)
162174
case 'D':
163175
vip_table_path = optarg;
164176
break;
177+
case 'h':
178+
print_usage(stdout);
179+
return 0;
165180
default:
166-
print_usage();
181+
print_usage(stderr);
167182
return 1;
168183
}
169184
}
170185

171186
/* at least 2 non optional args required */
172187
if ((optind + 2) > argc) {
173-
print_usage();
188+
print_usage(stderr);
174189
return 1;
175190
}
176191

0 commit comments

Comments
 (0)