From: Dragan Simic <dsimic@manjaro.org>
To: Michael Walle <mwalle@kernel.org>,
Caleb Connolly <caleb.connolly@linaro.org>
Cc: clamor95@gmail.com, sjg@chromium.org, sumit.garg@linaro.org,
trini@konsulko.com, u-boot@lists.denx.de
Subject: Re: [PATCH v2] boot: add support for button commands
Date: Thu, 18 Jan 2024 07:57:03 +0100 [thread overview]
Message-ID: <5af4762a66ab630ea8e391183eb7ee4f@manjaro.org> (raw)
In-Reply-To: <20240111093808.3678028-1-mwalle@kernel.org>
Hello Caleb and Michael,
On 2024-01-11 10:38, Michael Walle wrote:
>>> This is simply awesome, but I see one possible issue -- the need to
>>> have
>>> proper environment variables defined for a particular board or
>>> device,
>>> to make the buttons work as expected. Obviously, those environment
>>> variables can be absent or can become missing for numerous reasons.
>>
>> Is CFG_EXTRA_ENV_SETTINGS not persistent enough?
>
> IMHO no. Because a user might accidentially mess up the environment
> variables.
I apologize for my delayed response.
Using CONFIG_EXTRA_ENV_SETTINGS should be good enough to provide
the fallback defaults. However, the users can still mess the things up,
but again, they can do that already in many places.
>>> I think that we should have an additional mechanism in place that
>>> defines the buttons and the associated commands even if no
>>> environment
>>> variables are found. Like a set of fallback defaults for a
>>> particular
>>> board or device, built into the U-Boot image. For example, Rockchip
>>> boards have those defaults pretty well defined.
>>
>> A programmatic API for register button/cmd mapping from
>> board_late_init() (for example) sounds sensible to me.
>
> I don't know if it has to be that complex, or if it will be enough
> to just have some compile-time constants like CONFIG_BUTTON_CMD_N.
Having compile-time constants is also a viable option, IMHO. We should
just need some fallback mechanism, and the simpler the better.
>> Is this really an issue that invalidates the implementation proposed
>> here though? It feels much more like a nice-to-have addition that
>> maybe
>> we could leave out for now?
>
> Agreed. Looks like one can add it to get_button_cmd() later.
I also agree, but it should be added eventually.
>> It also has a MUCH wider scope imo - should board override env or vice
>> versa? What about triggering default AND custom actions for one button
>> press? What if a board wants to register a callback function instead
>> of
>> running a command?) - these are questions I don't want to answer with
>> this patch.
Yes, all this opens quite a few questions. IMHO, we should simply have
some fallback mechanism, for which using CONFIG_EXTRA_ENV_SETTINGS seems
fine to me, and leave everything else to as it already is. Sure, the
users could mess it up, but that can already happen in many places.
> One use case I have is restoring the default environment *in any case*;
> regardless what the state of the board is. In this case, the
> environment
> must not override the button settings. This can be a compiled-in
> command, which always takes precedence.
To me, having an option to restore the default environment isn't a bad
idea, but not automatically and always. Perhaps some other mechanism
that
triggers the restoration should be devised.
> If you want to be able to overwrite a button command, then I guess you
> can already do that with the environment setting. Provide sane defaults
> via CFG_EXTRA_ENV_SETTINGS and a user can then overwrite it.
I agree.
> In summary, the registered (compiled-in) command should always take
> precedence. If one wants to supply a default command which can be
> changed later, that can go via the (compiled-in) default environment.
Sorry, this is a bit confusing to me. Didn't you write above that
the users should be able to change the associated commands through
the environment variables?
next prev parent reply other threads:[~2024-01-18 6:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 11:51 [PATCH v2] boot: add support for button commands Caleb Connolly
2024-01-10 18:08 ` Dragan Simic
2024-01-10 20:09 ` Caleb Connolly
2024-01-11 9:38 ` Michael Walle
2024-01-18 6:57 ` Dragan Simic [this message]
2024-01-18 7:59 ` Michael Walle
2024-01-18 14:33 ` Dragan Simic
2024-01-18 15:11 ` Michael Walle
2024-01-18 15:14 ` Dragan Simic
2024-02-13 22:32 ` Tom Rini
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=5af4762a66ab630ea8e391183eb7ee4f@manjaro.org \
--to=dsimic@manjaro.org \
--cc=caleb.connolly@linaro.org \
--cc=clamor95@gmail.com \
--cc=mwalle@kernel.org \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.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