Skip to contentSkip to conversation

CMD commands improvements

PATCH In review Svyatoslav Ryhel 3 participants 4 messages Mar 20, 2023 – Mar 31, 2023

lore
Share & tools
lore
#0 lore raw

v4 cover CMD commands improvements

- 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(+)
Signature · 1 line
2.37.2
#1 lore raw

PATCH v4 1/1 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.

---
 cmd/Kconfig            |  6 ++++++
 cmd/usb_mass_storage.c | 10 ++++++++++
 2 files changed, 16 insertions(+)
cmd/Kconfig +6 -0
index 2caa4af71c..920ea854b3 100644
@@ -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
cmd/usb_mass_storage.c +10 -0
index b7daaa6e8e..c3cc1975f9 100644
@@ -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();
 	}
 
Signature · 1 line
2.37.2
Reviewed-by on v4 1/1
#2 lore raw

Re: [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key

Quoted 6 lines · Svyatoslav Ryhel

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.

Quoted 6 lines
---
 cmd/Kconfig            |  6 ++++++
 cmd/usb_mass_storage.c | 10 ++++++++++
 2 files changed, 16 insertions(+)
#3 lore raw

Re: [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key

In reply to Svyatoslav Ryhel
Quoted 7 lines · Svyatoslav Ryhel

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.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom