fel: Do a clean exit(0) after printing usage help
Gracefully shut down the FEL utility, instead of continuing execution. This avoids a possible "ERROR: Allwinner USB FEL device not found!" when doing a plain `./sunxi-fel` without any arguments (and no suitable USB device connected). Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
This commit is contained in:
parent
b7e092ec3f
commit
425278ac0d
5
fel.c
5
fel.c
@ -1369,8 +1369,6 @@ int main(int argc, char **argv)
|
||||
libusb_device_handle *handle;
|
||||
int busnum = -1, devnum = -1;
|
||||
int iface_detached = -1;
|
||||
int rc = libusb_init(NULL);
|
||||
assert(rc == 0);
|
||||
|
||||
if (argc <= 1) {
|
||||
printf("Usage: %s [options] command arguments... [command...]\n"
|
||||
@ -1407,6 +1405,7 @@ int main(int argc, char **argv)
|
||||
" fill address length value Fill memory\n"
|
||||
, argv[0]
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* process all "prefix"-type arguments first */
|
||||
@ -1434,6 +1433,8 @@ int main(int argc, char **argv)
|
||||
argv += 1;
|
||||
}
|
||||
|
||||
int rc = libusb_init(NULL);
|
||||
assert(rc == 0);
|
||||
handle = open_fel_device(busnum, devnum, AW_USB_VENDOR_ID, AW_USB_PRODUCT_ID);
|
||||
assert(handle != NULL);
|
||||
rc = libusb_claim_interface(handle, 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user