[RFC PATCH] usb: gadget: dfu: Rework dfu command to use usbgadget

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Sep 10 01:46:23 PDT 2021


Hi Jules,

On 30.08.21 16:48, Jules Maselbas wrote:
> The dfu command now uses the composite multi gadget to register the usb
> functionality. This allows the removal of the usb composite driver from
> dfu.c
> 
> As the dfu command is blocking the command slice must be released while
> the dfu gadget is running in order to do operations on the file system.
> 
> The usb_dfu_register() function is replaced with usb_dfu_detached() for
> the dfu command to return a different value depending on if it has been
> interrupted with CTRL-C or if the gadget has been detached.
> 
> Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
> ---
>  commands/dfu.c           |  24 +++---
>  drivers/usb/gadget/dfu.c | 163 +--------------------------------------
>  include/usb/dfu.h        |   2 +-
>  3 files changed, 15 insertions(+), 174 deletions(-)
> 
> diff --git a/commands/dfu.c b/commands/dfu.c
> index 3132a7479d..0d8a703300 100644
> --- a/commands/dfu.c
> +++ b/commands/dfu.c
> @@ -11,6 +11,7 @@
>  #include <fs.h>
>  #include <xfuncs.h>
>  #include <usb/dfu.h>
> +#include <usb/gadget-multi.h>
>  #include <linux/err.h>
>  
>  /* dfu /dev/self0(bootloader)sr,/dev/nand0.root.bb(root)
> @@ -20,28 +21,27 @@
>   */
>  static int do_dfu(int argc, char *argv[])
>  {
> -	struct f_dfu_opts opts;
>  	char *argstr;
> -	struct usb_dfu_dev *dfu_alts = NULL;
>  	int ret;
>  
>  	if (argc != optind + 1)
>  		return COMMAND_ERROR_USAGE;
>  
>  	argstr = argv[optind];
> +	ret = usbgadget_register(true, argstr, false, NULL, false, false);
> +	if (ret)
> +		return ret;

next branch has a different prototype for usbgadget_register now.
Could you adapt it for v2?


Cheers,
Ahmad


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list