diff options
Diffstat (limited to 'drivers/usb/gadget/autostart.c')
-rw-r--r-- | drivers/usb/gadget/autostart.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c index 465d8fd380..f640a9667d 100644 --- a/drivers/usb/gadget/autostart.c +++ b/drivers/usb/gadget/autostart.c @@ -11,6 +11,8 @@ * GNU General Public License for more details. * */ +#define pr_fmt(fmt) "usbgadget autostart: " fmt + #include <common.h> #include <command.h> #include <errno.h> @@ -28,6 +30,7 @@ static int autostart; static int acm; static char *fastboot_function; +static int fastboot_bbu; static int usbgadget_autostart(void) { @@ -37,16 +40,28 @@ static int usbgadget_autostart(void) if (!autostart) return 0; - setenv("otg.mode", "peripheral"); - opts = xzalloc(sizeof(*opts)); opts->release = usb_multi_opts_release; - if (fastboot_function) + if (fastboot_function) { opts->fastboot_opts.files = file_list_parse(fastboot_function); + if (IS_ERR(opts->fastboot_opts.files)) { + pr_err("Parsing file list \"%s\" failed: %s\n", fastboot_function, + strerrorp(opts->fastboot_opts.files)); + opts->fastboot_opts.files = NULL; + } + + opts->fastboot_opts.export_bbu = fastboot_bbu; + } opts->create_acm = acm; + if (!opts->fastboot_opts.files && !opts->create_acm) { + pr_warn("No functions to register\n"); + return 0; + } + + setenv("otg.mode", "peripheral"); ret = usb_multi_register(opts); if (ret) @@ -63,6 +78,7 @@ static int usbgadget_globalvars_init(void) globalvar_add_simple_bool("usbgadget.acm", &acm); globalvar_add_simple_string("usbgadget.fastboot_function", &fastboot_function); + globalvar_add_simple_bool("usbgadget.fastboot_bbu", &fastboot_bbu); return 0; } @@ -77,3 +93,6 @@ BAREBOX_MAGICVAR_NAMED(global_usbgadget_acm, BAREBOX_MAGICVAR_NAMED(global_usbgadget_fastboot_function, global.usbgadget.fastboot_function, "usbgadget: Create Android Fastboot function"); +BAREBOX_MAGICVAR_NAMED(global_usbgadget_fastboot_bbu, + global.usbgadget.fastboot_bbu, + "usbgadget: export barebox update handlers via fastboot"); |