Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB990C25B50 for ; Mon, 23 Jan 2023 20:04:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 706CF85785; Mon, 23 Jan 2023 21:04:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FXRJDCsM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6682E85786; Mon, 23 Jan 2023 21:04:12 +0100 (CET) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4569D856E3 for ; Mon, 23 Jan 2023 21:04:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=clamor95@gmail.com Received: by mail-wr1-x431.google.com with SMTP id y1so7420198wru.2 for ; Mon, 23 Jan 2023 12:04:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DBWtUy3VQXak5Pij7PsaIwIuo5FRN11FzUoUEdXWQ/E=; b=FXRJDCsMvhSLB21SMD2MMDw2trxjbHrZJHklCkTpQzwI7wfpVv+tin6mOoUKBN/TCj CCMH4iYX8HPHUiZcDXr7neLu8DiTLSrrGUQmAXE199dEMmykzF8pMyuOdNzHGL0n10LR n5EeIvRJKt82UhhqIbAzHv0C0kNoe1GWjA3k7wYN/xnE+ZtptZIFT20UetUW8SHc0VrQ Fp/gdy06iGZO7CrbUnhRXxjdpENgT4jvgb+oUXxGEL2USD2F1OZJc6P55oBe7yPmXXnx ZbCtD42Cx4XpAZVMcGk0Xi7hVEl3hUhOtaGIueA7bcW1OSN8vF++MNv4rW6a+NWlowwY jB0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DBWtUy3VQXak5Pij7PsaIwIuo5FRN11FzUoUEdXWQ/E=; b=y/GbuIYmCFTPYpVAD3kpRUMCbLi2IRGIh+JrdVAQVhgce+cVACfiIvMd51KtaUXmYm ShM5Ghzd976V0wcY72nON6xipEuAywWV4bu2dIPR2iiuJZOgqixNhiNH2A8wVmR2xcIN XX+tLpWwWn4UHh6rPePvC+8sESS5u53Z65pWDxg9GPkKcQaoThX9nJ6wjqNMVnfFCQt1 JGsX7+QNp/UuM0Z17NfUbPa9Q6QXlkD8yhBz3eHgxPUJ2VAqweglFvkVoyTqpXrWlr0P MOR9oqvIwqjnOjGaxrDv2LMVOidvNx7KUkHfZptOEQomApnPwxZ9qomZs3AunZIFuRAO Z5Sw== X-Gm-Message-State: AFqh2kqDHMj70WoryK6XvIU27M/LzO+yt2O6PpeVjgrf9CxR5y3Q3WO3 xvmBNsLKkvdN67Gv5211PAE= X-Google-Smtp-Source: AMrXdXv5D9qP+igobK+waglYyKm0gXSfB2SMy4SdOo8qlCUF120dG6Vktmldnj0iOPJ14KkIBVV/KA== X-Received: by 2002:a05:6000:d2:b0:2bd:e0e8:694a with SMTP id q18-20020a05600000d200b002bde0e8694amr19770813wrx.23.1674504248762; Mon, 23 Jan 2023 12:04:08 -0800 (PST) Received: from DESKTOP-BE01SG2.localdomain ([91.204.85.69]) by smtp.gmail.com with ESMTPSA id h14-20020a5d430e000000b002366e3f1497sm221779wrq.6.2023.01.23.12.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 12:04:08 -0800 (PST) From: Svyatoslav Ryhel To: Lukasz Majewski , Simon Glass , Ilias Apalodimas , Heinrich Schuchardt , Masahisa Kojima , Ashok Reddy Soma , John Keeping , Marek Vasut , Svyatoslav Ryhel , =?UTF-8?q?Jonas=20Schw=C3=B6bel?= , Maxim Schwalm , Hector Palacios Cc: u-boot@lists.denx.de Subject: [PATCH v1 2/2] cmd: ums: abort mounting by pressing any key Date: Mon, 23 Jan 2023 22:03:54 +0200 Message-Id: <20230123200354.3642-3-clamor95@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123200354.3642-1-clamor95@gmail.com> References: <20230123200354.3642-1-clamor95@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 --- cmd/Kconfig | 6 ++++++ cmd/usb_mass_storage.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 4fe2c75de2..5c177f87ea 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1536,6 +1536,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 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..ade81013d0 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -231,6 +231,15 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, goto cleanup_register; } + if (IS_ENABLED(CONFIG_UMS_ABORT_KEYED)) { + /* Abort by pressing any key */ + if (getchar()) { + printf("\rOperation aborted.\n"); + rc = CMD_RET_SUCCESS; + goto cleanup_register; + } + } + schedule(); } -- 2.25.1