summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-08-15 11:17:33 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-08-17 13:37:12 +0200
commit352a851259fc158ec391bd4e9e346e08d91c9dfe (patch)
treee4e4eb9c492be8869cac7508ebe8b50544ff3db8 /include/usb
parentf049952dbb4879e6e5a3759028ff70aab7c154e5 (diff)
downloadbarebox-352a851259fc158ec391bd4e9e346e08d91c9dfe.tar.gz
barebox-352a851259fc158ec391bd4e9e346e08d91c9dfe.tar.xz
usbgadget: autostart: add usbgadget_autostart() for board code
global.usbgadget.autostart is registered at postenvironment level initcall, so changing its value before that doesn't have the desired effect of automatically starting the usb gadget. Refactor the code so that we have a usbgadget_do_autostart() function that first checks if it should run at all and that it's the right time to run. This function can be called at any time and based on that implement usbgadget_autostart() to let board code be able to trigger the autorun functionality. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220815091733.1973736-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/gadget-multi.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/usb/gadget-multi.h b/include/usb/gadget-multi.h
index 2d8d7533a8..e67ca165c1 100644
--- a/include/usb/gadget-multi.h
+++ b/include/usb/gadget-multi.h
@@ -3,6 +3,7 @@
#ifndef __USB_GADGET_MULTI_H
#define __USB_GADGET_MULTI_H
+#include <linux/types.h>
#include <usb/fastboot.h>
#include <usb/dfu.h>
#include <usb/usbserial.h>
@@ -36,4 +37,6 @@ struct usbgadget_funcs {
int usbgadget_register(const struct usbgadget_funcs *funcs);
+void usbgadget_autostart(bool enable);
+
#endif /* __USB_GADGET_MULTI_H */