usbgadget: autostart: add DFU support
PATCH 1/1 usbgadget: autostart: add DFU support
Use global variable dfu_function to autostart DFU. As similar code is used to start multifunction gadget using command, move common code to common/usbgadget.c and consolidate it.
---
This is a draft, comments welcome. Getting
Cannot set parameter otg.mode: No such device
but that's same as before this patch. Documentation is probably also worth updating...
commands/Kconfig | 1 - commands/usbgadget.c | 66 +++----------- common/Kconfig | 7 ++ common/Makefile | 1 + .../gadget/autostart.c => common/usbgadget.c | 85 ++++++++++++++----- drivers/usb/gadget/Kconfig | 8 +- drivers/usb/gadget/Makefile | 1 - 7 files changed, 89 insertions(+), 80 deletions(-) rename drivers/usb/gadget/autostart.c => common/usbgadget.c (51%)
commands/Kconfig +0 -1
@@ -1910,7 +1910,6 @@ config CMD_USB config CMD_USBGADGET bool depends on USB_GADGET - select FILE_LIST prompt "usbgadget" config CMD_WD
commands/usbgadget.c +13 -53
94 lines not on this page · raw message
common/Kconfig +7 -0
@@ -115,6 +115,13 @@ config UBIFORMAT depends on MTD_UBI default y +config USBGADGET_START + bool + depends on CMD_USBGADGET || USB_GADGET_AUTOSTART + select ENVIRONMENT_VARIABLES + select FILE_LIST + default y + config BOOT bool
common/Makefile +1 -0
@@ -64,6 +64,7 @@ obj-$(CONFIG_UBIFORMAT) += ubiformat.o obj-$(CONFIG_BAREBOX_UPDATE_IMX_NAND_FCB) += imx-bbu-nand-fcb.o obj-$(CONFIG_BOOT) += boot.o obj-$(CONFIG_SERIAL_DEV_BUS) += serdev.o +obj-$(CONFIG_USBGADGET_START) += usbgadget.o ifdef CONFIG_PASSWORD
common/usbgadget.c renamed from drivers/usb/gadget/autostart.c +65 -20
129 lines not on this page · raw message
drivers/usb/gadget/Kconfig +3 -5
@@ -33,13 +33,11 @@ config USB_GADGET_DRIVER_PXA27X config USB_GADGET_AUTOSTART bool default y - select ENVIRONMENT_VARIABLES - select FILE_LIST prompt "Automatically start usbgadget on boot" help - Enabling this option allows to automatically start a fastboot - gadget during boot. This behaviour is controlled with the - global.usbgadget.fastboot_function variable. + Enabling this option allows to automatically start a dfu or + fastboot gadget during boot. This behaviour is controlled with + the global.usbgadget.{dfu,fastboot}_function variable. comment "USB Gadget drivers"
drivers/usb/gadget/Makefile +0 -1
@@ -1,6 +1,5 @@ obj-$(CONFIG_USB_GADGET) += composite.o config.o usbstring.o epautoconf.o udc-core.o functions.o config.o multi.o -obj-$(CONFIG_USB_GADGET_AUTOSTART) += autostart.o obj-$(CONFIG_USB_GADGET_SERIAL) += u_serial.o serial.o f_serial.o f_acm.o obj-$(CONFIG_USB_GADGET_DFU) += dfu.o obj-$(CONFIG_USB_GADGET_FASTBOOT) += f_fastboot.o
Signature · 7 lines
2.19.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Ladis,
Quoted 8 lines · Ladislav Michl
Use global variable
dfu_functionto autostart DFU. As similar code is used to start multifunction gadget using command, move common code tocommon/usbgadget.cand consolidate it.Signed-off-by Ladislav Michl <[email protected]>---
This is a draft, comments welcome. Getting
Cannot set parameter otg.mode: No such device
I just sent a fix for this.
Quoted 2 lines
but that's same as before this patch. Documentation is probably also worth updating...
Indeed.
commands/usbgadget.c line 36
Quoted 12 lines
commands/usbgadget.c +4
-0@@ -30,14 +30,18 @@#include <usb/dfu.h> #include <usb/gadget-multi.h> +int usbgadget_register (bool dfu_set,const char *dfu_opts, +bool fastboot_set,const char *fastboot_opts, +bool create_serial,bool is_acm,bool export_bbu); +
This should get a prototype somewhere in include/, but that's probably due to the draft status of this patch.
Otherwise looks fine to me.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 7 lines · Sascha Hauer
Hi Ladis,
Quoted 4 lines · Ladislav Michl
Use global variable
dfu_functionto autostart DFU. As similar code is used to start multifunction gadget using command, move common code tocommon/usbgadget.cand consolidate it.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Ladislav Michl <[email protected]>---
This is a draft, comments welcome. Getting
Cannot set parameter otg.mode: No such deviceI just sent a fix for this.
Thanks, tested, added.
Quoted 4 lines
Quoted 2 lines
but that's same as before this patch. Documentation is probably also worth updating...
Indeed.
Will add prepatch to document bbu then.
Quoted 8 lines
Quoted 8 lines
commands/usbgadget.c +0
-0@@ -30,14 +30,18 @@#include <usb/dfu.h> #include <usb/gadget-multi.h>
Quoted 7 lines
commands/usbgadget.c line 36
Quoted 4 lines
commands/usbgadget.c +4
-0+int usbgadget_register (bool dfu_set,const char *dfu_opts, +bool fastboot_set,const char *fastboot_opts, +bool create_serial,bool is_acm,bool export_bbu); +This should get a prototype somewhere in
include/, but that's probably due to the draft status of this patch.
Any idea where would it fit? Or just create new file (which seems overkill to me)?
Quoted 1 line
Otherwise looks fine to me.
usbgadget takes -s switch to create serial gadget and -a to create acm. However I fail to see how is creating former done.
ladis
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 40 lines · Ladislav Michl
Quoted 7 lines · Sascha Hauer
Hi Ladis,
Quoted 4 lines · Ladislav Michl
Use global variable
dfu_functionto autostart DFU. As similar code is used to start multifunction gadget using command, move common code tocommon/usbgadget.cand consolidate it.Quoted 6 lines
Quoted 4 lines
Signed-off-by Ladislav Michl <[email protected]>---
This is a draft, comments welcome. Getting
Cannot set parameter otg.mode: No such deviceI just sent a fix for this.
Thanks, tested, added.
Quoted 4 lines
Quoted 2 lines
but that's same as before this patch. Documentation is probably also worth updating...
Indeed.
Will add prepatch to document bbu then.
Quoted 8 lines
Quoted 8 lines
commands/usbgadget.c +0
-0@@ -30,14 +30,18 @@#include <usb/dfu.h> #include <usb/gadget-multi.h> Quoted 7 lines
commands/usbgadget.c line 36
Quoted 4 lines
commands/usbgadget.c +4
-0+int usbgadget_register (bool dfu_set,const char *dfu_opts, +bool fastboot_set,const char *fastboot_opts, +bool create_serial,bool is_acm,bool export_bbu); +This should get a prototype somewhere in
include/, but that's probably due to the draft status of this patch.
Quoted 2 lines
Any idea where would it fit? Or just create new file (which seems overkill to me)?
include/usb/gadget-multi.h perhaps? Not a perfect match, but in the end that's what the function does: create a USB multi device.
Quoted 5 lines
Quoted 2 lines
Otherwise looks fine to me.
usbgadget takes -s switch to create serial gadget and -a to create acm. However I fail to see how is creating former done.
To be honest I always use acm and never found out how the generic serial works. It may have bitrotted over time, but for me it never worked.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 6 lines · Sascha Hauer
Quoted 2 lines · Ladislav Michl
usbgadget takes -s switch to create serial gadget and -a to create acm. However I fail to see how is creating former done.
To be honest I always use acm and never found out how the generic serial works. It may have bitrotted over time, but for me it never worked.
Fair enough then. I do not even see support for it in the initial commit, which introduces '-s' switch. I suggest removing it altogether, perhaps with an option to silently fall back to create ACM as well. ACM is so common, that using anything else for this (console) purpose is probably unwise anyway. Objections?
ladis
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox