diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-10-19 15:07:40 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-10-19 15:07:40 +0200 |
commit | a10a8e5e502fb5d5a6f945e208bd00a9bdeca5e2 (patch) | |
tree | cd4f007c081b7693424411cea71cb6c9e98ff379 /commands | |
parent | 7f04124c149fa4d8e8f657907c581f10987003e2 (diff) | |
parent | 05761813eff43493ee0519f0699a396de3f007a5 (diff) | |
download | barebox-a10a8e5e502fb5d5a6f945e208bd00a9bdeca5e2.tar.gz barebox-a10a8e5e502fb5d5a6f945e208bd00a9bdeca5e2.tar.xz |
Merge branch 'for-next/usbgadget'
Diffstat (limited to 'commands')
-rw-r--r-- | commands/usbgadget.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/commands/usbgadget.c b/commands/usbgadget.c index ba09f97847..507871edd2 100644 --- a/commands/usbgadget.c +++ b/commands/usbgadget.c @@ -33,11 +33,11 @@ static int do_usbgadget(int argc, char *argv[]) { int opt, ret; - int acm = 1, create_serial = 0, fastboot_set = 0; + int acm = 1, create_serial = 0, fastboot_set = 0, fastboot_export_bbu = 0; const char *fastboot_opts = NULL, *dfu_opts = NULL; struct f_multi_opts *opts; - while ((opt = getopt(argc, argv, "asdA::D:")) > 0) { + while ((opt = getopt(argc, argv, "asdA::D:b")) > 0) { switch (opt) { case 'a': acm = 1; @@ -54,6 +54,9 @@ static int do_usbgadget(int argc, char *argv[]) fastboot_opts = optarg; fastboot_set = 1; break; + case 'b': + fastboot_export_bbu = 1; + break; case 'd': usb_multi_unregister(); return 0; @@ -83,10 +86,15 @@ static int do_usbgadget(int argc, char *argv[]) if (fastboot_opts) { opts->fastboot_opts.files = file_list_parse(fastboot_opts); + if (IS_ERR(opts->fastboot_opts.files)) + goto err_parse; + opts->fastboot_opts.export_bbu = fastboot_export_bbu; } if (dfu_opts) { opts->dfu_opts.files = file_list_parse(dfu_opts); + if (IS_ERR(opts->dfu_opts.files)) + goto err_parse; } if (create_serial) { @@ -98,6 +106,13 @@ static int do_usbgadget(int argc, char *argv[]) usb_multi_opts_release(opts); return ret; + +err_parse: + printf("Cannot parse file list \"%s\": %s\n", fastboot_opts, strerrorp(opts->fastboot_opts.files)); + + free(opts); + + return 1; } BAREBOX_CMD_HELP_START(usbgadget) @@ -108,6 +123,7 @@ BAREBOX_CMD_HELP_OPT ("-a", "Create CDC ACM function") BAREBOX_CMD_HELP_OPT ("-s", "Create Generic Serial function") BAREBOX_CMD_HELP_OPT ("-A [desc]", "Create Android Fastboot function. If 'desc' is not provided,") BAREBOX_CMD_HELP_OPT ("", "trying to use 'global.usbgadget.fastboot_function' variable.") +BAREBOX_CMD_HELP_OPT ("-b", "include registered barebox update handlers (fastboot specific)") BAREBOX_CMD_HELP_OPT ("-D <desc>", "Create DFU function") BAREBOX_CMD_HELP_OPT ("-d", "Disable the currently running gadget") BAREBOX_CMD_HELP_END |