[PATCH 1/2] cmd: fastboot: Add keyed abort option
Sam Day
me at samcday.com
Fri Jun 19 01:48:24 CEST 2026
Hello Mattijs & Simon,
On Monday, 15 June 2026 at 10:30 PM, Mattijs Korpershoek <mkorpershoek at kernel.org> wrote:
> Hi Simon,
>
> On Sun, Jun 14, 2026 at 05:49, Simon Glass <sjg at chromium.org> wrote:
>
> > Hi Sam,
> >
> > On 2026-06-02T08:45:46, Sam Day via B4 Relay
> > <devnull+me.samcday.com at kernel.org> wrote:
> >> cmd: fastboot: Add keyed abort option
> >>
> >> Works the same as CONFIG_CMD_UMS_ABORT_KEYED does: any keypress will
> >> abort fastboot mode (rather than only ctrl-c).
> >>
> >> Signed-off-by: Sam Day <me at samcday.com>
> >>
> >> cmd/Kconfig | 6 ++++++
> >> cmd/fastboot.c | 9 ++++++++-
> >> 2 files changed, 14 insertions(+), 1 deletion(-)
> >
> >> diff --git a/cmd/fastboot.c b/cmd/fastboot.c
> >> @@ -103,8 +103,15 @@ static int do_fastboot_usb(int argc, char *const argv[],
> >> while (1) {
> >> if (g_dnl_detach())
> >> break;
> >> - if (ctrlc())
> >> + if (IS_ENABLED(CONFIG_CMD_FASTBOOT_ABORT_KEYED)) {
> >> + if (tstc()) {
> >> + getchar();
> >> + puts("\rOperation aborted.\n");
> >> + break;
> >> + }
> >> + } else if (ctrlc()) {
> >> break;
> >> + }
> >
> > I wonder if you could create a shared function (gadget_abort_check()
> > ?) to keep this and the code in usb_mass_storage.c in sync?
>
> While I usually advocate to avoid code duplication, I don't think it's
> needed to create a new function here. It's only a couple of very simple
> lines.
>
> To me this can stay as is.
I lean this way too, so I opted to leave this code as it is.
>
> >
> >> diff --git a/cmd/fastboot.c b/cmd/fastboot.c
> >> @@ -103,8 +103,15 @@ static int do_fastboot_usb(int argc, char *const argv[],
> >> + if (IS_ENABLED(CONFIG_CMD_FASTBOOT_ABORT_KEYED)) {
> >> + if (tstc()) {
> >> + getchar();
> >> + puts("\rOperation aborted.\n");
> >> + break;
> >> + }
> >
> > Can you please update doc/android/fastboot.rst to mention the new
> > Kconfig and the abort behaviour. There is currently nothing in that
> > file about how to leave fastboot mode at all.
>
> For the current behaviour, I have send:
> https://lore.kernel.org/all/20260615-fastboot-doc-ctrl-c-v1-1-f932dea17c0a@kernel.org/
Thanks, I've added that as a dependency to the v2 of this series, and
supplemented it with a paragraph about CONFIG_CMD_FASTBOOT_ABORT_KEYED.
Cheers,
-Sam
>
> >
> > Regards,
> > Simon
>
More information about the U-Boot
mailing list