fastboot: move help command before usb connect
Move the help command handling before the call to open_device
so that is doesn't block when no device is connected.
Bug: 7078873
Change-Id: I4e9a4317bd72b4ceb4b9fc838eafd2e57b17a473
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index b6eab8c..c9def7b 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -832,6 +832,11 @@
return 0;
}
+ if (argc > 0 && !strcmp(*argv, "help")) {
+ usage();
+ return 0;
+ }
+
usb = open_device();
while (argc > 0) {
@@ -922,9 +927,6 @@
wants_reboot = 1;
} else if(!strcmp(*argv, "oem")) {
argc = do_oem_command(argc, argv);
- } else if (!strcmp(*argv, "help")) {
- usage();
- return 0;
} else {
usage();
return 1;