All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/1] CMD commands improvements
@ 2023-03-20 19:01 Svyatoslav Ryhel
  2023-03-20 19:01 ` [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key Svyatoslav Ryhel
  0 siblings, 1 reply; 4+ messages in thread
From: Svyatoslav Ryhel @ 2023-03-20 19:01 UTC (permalink / raw)
  To: Lukasz Majewski, Simon Glass, Ilias Apalodimas,
	Heinrich Schuchardt, Masahisa Kojima, John Keeping,
	Svyatoslav Ryhel, Maxim Schwalm
  Cc: u-boot

- add ability for 'ums' command to 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.
Current implementation uses Kconfig entry.

Changelog from v3
- re-send after month

Changelog from v2
- fix stuck of ums due to getchar loop. Now getchar is
called after tstc check.

Changelog from v1
- 'continue' command commit was dropped as there already
exists 'pause' command with same function.
- UMS_ABORT_KEYED renamed to CMD_UMS_ABORT_KEYED

Svyatoslav Ryhel (1):
  cmd: ums: abort mounting by pressing any key

 cmd/Kconfig            |  6 ++++++
 cmd/usb_mass_storage.c | 10 ++++++++++
 2 files changed, 16 insertions(+)

-- 
2.37.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key
  2023-03-20 19:01 [PATCH v4 0/1] CMD commands improvements Svyatoslav Ryhel
@ 2023-03-20 19:01 ` Svyatoslav Ryhel
  2023-03-23 17:54   ` Simon Glass
  2023-03-31 14:17   ` Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Svyatoslav Ryhel @ 2023-03-20 19:01 UTC (permalink / raw)
  To: Lukasz Majewski, Simon Glass, Ilias Apalodimas,
	Heinrich Schuchardt, Masahisa Kojima, John Keeping,
	Svyatoslav Ryhel, Maxim Schwalm
  Cc: u-boot

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>
---
 cmd/Kconfig            |  6 ++++++
 cmd/usb_mass_storage.c | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 2caa4af71c..920ea854b3 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1542,6 +1542,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 b7daaa6e8e..c3cc1975f9 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();
 	}
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key
  2023-03-20 19:01 ` [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key Svyatoslav Ryhel
@ 2023-03-23 17:54   ` Simon Glass
  2023-03-31 14:17   ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2023-03-23 17:54 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Lukasz Majewski, Ilias Apalodimas, Heinrich Schuchardt,
	Masahisa Kojima, John Keeping, Maxim Schwalm, u-boot

On Tue, 21 Mar 2023 at 08:02, Svyatoslav Ryhel <clamor95@gmail.com> wrote:
>
> 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>
> ---
>  cmd/Kconfig            |  6 ++++++
>  cmd/usb_mass_storage.c | 10 ++++++++++
>  2 files changed, 16 insertions(+)
>


Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key
  2023-03-20 19:01 ` [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key Svyatoslav Ryhel
  2023-03-23 17:54   ` Simon Glass
@ 2023-03-31 14:17   ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2023-03-31 14:17 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Lukasz Majewski, Simon Glass, Ilias Apalodimas,
	Heinrich Schuchardt, Masahisa Kojima, John Keeping,
	Maxim Schwalm, u-boot

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

On Mon, Mar 20, 2023 at 09:01:43PM +0200, Svyatoslav Ryhel wrote:

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

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-31 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 19:01 [PATCH v4 0/1] CMD commands improvements Svyatoslav Ryhel
2023-03-20 19:01 ` [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key Svyatoslav Ryhel
2023-03-23 17:54   ` Simon Glass
2023-03-31 14:17   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.