public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] dfu:cmd: get the default command arguments from environment
Date: Fri, 13 Jun 2014 10:28:55 +0200	[thread overview]
Message-ID: <539AB647.7010508@samsung.com> (raw)
In-Reply-To: <5399D7B8.5090909@wwwdotorg.org>

Dear Stephen,

On 06/12/2014 06:39 PM, Stephen Warren wrote:
> 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> [<list>] - use command line args
>> - dfu [<list>] - 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

You are right, I can do this in that way. But in my intention I would 
like to simplify those specific commands so much as they could be.

In this case, writing:
  "run somecmd" - is also frustrating as writing:
  "somecmd arg1 arg2 ...argx"
instead of:
  "thor"  - just upgrade my device for predefined setup

In both cases the command always uses the same arguments - because it is 
device specific and actually determined by config - or board design.

So as you can see, thor and dfu commands are specific - always takes 
constant parameters. And I think that this is a good reason to make it 
so simply as. e.g. android "fastboot" command.

>
> 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?
>

This should be threat the same as dfu_alt_info, and it's a rather 
simplification for the user, more then bloating the code.

Looking for cmdline args in the environment in those two commands,
could be changed to modification of just one dfu function:
- dfu_init_env_entities() - could take the NULL pointers and then do 
the proper job.
- but there is still left the USB controller - should be checked in each 
command, rather than checking in each board file.
By the way USB index is not used anywhere...

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

  reply	other threads:[~2014-06-13  8:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 14:25 [U-Boot] [PATCH 1/4] dfu:cmd: get the default command arguments from environment Przemyslaw Marczak
2014-06-12 14:25 ` [U-Boot] [PATCH 2/4] thor:cmd: " Przemyslaw Marczak
2014-06-12 14:25 ` [U-Boot] [PATCH 3/4] trats2:config: add default dfu device environment setup Przemyslaw Marczak
2014-06-12 14:25 ` [U-Boot] [PATCH 4/4] trats:config: " Przemyslaw Marczak
2014-06-12 16:39 ` [U-Boot] [PATCH 1/4] dfu:cmd: get the default command arguments from environment Stephen Warren
2014-06-13  8:28   ` Przemyslaw Marczak [this message]
2014-06-13 16:35     ` Stephen Warren
2014-06-16 14:07       ` Przemyslaw Marczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=539AB647.7010508@samsung.com \
    --to=p.marczak@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox