[U-Boot] [PATCH 1/4] dfu:cmd: get the default command arguments from environment

Stephen Warren
2014-06-12T16:39:20Z

On 06/12/2014 08:25 AM, Przemyslaw Marczak wrote:
> This change adds support to store the default DFU cmd line
> arguments in the environment.
>
> This is useful for users who usually use the same arguments
> for dfu command and do the upgrade frequently.
>
> DFU command use cases:
> - dfu <usb ctrl> <if> <dev> [ ] - use command line args
> - dfu [ ] - take the default command line args from env
> And for both - optional list the initialized DFU entities.
>
> To use the default dfu device configuration user should define:
> - $dfu_usb_con - e.g. "0"
> - $dfu_interface - e.g. "mmc"
> - $dfu_device - e.g. "0"

Instead of adding code to every single command[1] to get cmdline
parameters from the environment, why not just define commands in the
environment and have the user run those.

In other words, the same effect can be achieved by the following
environment settings:

setenv dfu_default dfu \$dfu_usb_con \$dfu_interface \$dfu_device
(or even)
setenv dfu_default dfu 0 mmc 0

and have the user run:

run dfu_default

This avoids bloating the U-Boot code when the shell can already do this.

[1] Why limit this to dfu; why not ums, ls, load, part, ... too?