Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions qdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ int main(int argc, char **argv)
unsigned int slot = UINT_MAX;
struct qdl_device *qdl = NULL;
enum QDL_DEVICE_TYPE qdl_dev_type = QDL_DEVICE_USB;
bool run_firehose = false;

static struct option options[] = {
{"debug", no_argument, 0, 'd'},
Expand Down Expand Up @@ -534,8 +535,8 @@ int main(int argc, char **argv)
}
}

/* at least 2 non optional args required */
if ((optind + 2) > argc) {
/* the programmer arg is always required. */
if ((optind + 1) > argc) {
print_usage(stderr);
return 1;
}
Expand Down Expand Up @@ -574,7 +575,8 @@ int main(int argc, char **argv)
if (ret < 0)
exit(1);

do {
while (optind < argc) {
run_firehose = true;
type = detect_type(argv[optind]);
if (type < 0 || type == QDL_FILE_UNKNOWN)
errx(1, "failed to detect file type of %s\n", argv[optind]);
Expand Down Expand Up @@ -627,7 +629,8 @@ int main(int argc, char **argv)
errx(1, "%s type not yet supported", argv[optind]);
break;
}
} while (++optind < argc);
++optind;
}

ret = qdl_open(qdl, serial);
if (ret)
Expand All @@ -639,9 +642,9 @@ int main(int argc, char **argv)
if (ret < 0)
goto out_cleanup;

if (ufs_need_provisioning())
if (run_firehose && ufs_need_provisioning())
ret = firehose_provision(qdl);
else
else if (run_firehose)
ret = firehose_run(qdl);
if (ret < 0)
goto out_cleanup;
Expand Down