[PATCH 11/12] fastboot command: Add -b option to export bbu handlers

Sascha Hauer s.hauer at pengutronix.de
Wed Sep 27 05:09:09 PDT 2017


When -b is given the usbgadget command will automatically export the
registered bbu handlers via fastboot.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/usbgadget.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/commands/usbgadget.c b/commands/usbgadget.c
index 59359098ad..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;
@@ -85,6 +88,7 @@ static int do_usbgadget(int argc, char *argv[])
 		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) {
@@ -119,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
-- 
2.11.0




More information about the barebox mailing list