diff options
author | Svyatoslav Ryhel | 2023-03-20 21:01:43 +0200 |
---|---|---|
committer | Tom Rini | 2023-03-30 15:09:59 -0400 |
commit | a57adacf50d1bc0b5efd85b484a5c52a4c1ebcf1 (patch) | |
tree | 1d83c8662883c9c8bafa721abf9463624498ec2d /cmd | |
parent | 49b7d69f56d2f0ecb357079708603cf9df0b3699 (diff) |
cmd: ums: abort mounting by pressing any key
This patch introduses config which allows interrupt run of usb
mass storage with any key. This is especially useful on devices
with limited input capabilities like tablets and smatphones which
have only gpio keys in direct access.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/Kconfig | 6 | ||||
-rw-r--r-- | cmd/usb_mass_storage.c | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 8138ab98eab..8c9b430f99f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1552,6 +1552,12 @@ config CMD_USB_MASS_STORAGE export a block device: U-Boot, the USB device, acts as a simple external hard drive plugged on the host USB port. +config CMD_UMS_ABORT_KEYED + bool "UMS abort with any key" + depends on CMD_USB_MASS_STORAGE + help + Allow interruption of usb mass storage run with any key pressed. + config CMD_PVBLOCK bool "Xen para-virtualized block device" depends on XEN diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index b7daaa6e8e8..c3cc1975f9d 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -231,6 +231,16 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, goto cleanup_register; } + if (IS_ENABLED(CONFIG_CMD_UMS_ABORT_KEYED)) { + /* Abort by pressing any key */ + if (tstc()) { + getchar(); + printf("\rOperation aborted.\n"); + rc = CMD_RET_SUCCESS; + goto cleanup_register; + } + } + schedule(); } |