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 7ED83C6FD1D for ; Mon, 20 Mar 2023 19:02:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5CE1685BBD; Mon, 20 Mar 2023 20:02:20 +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="CP+Vdej6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C0DA284CFA; Mon, 20 Mar 2023 20:02:11 +0100 (CET) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (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 B23FC85B92 for ; Mon, 20 Mar 2023 20:02:06 +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-lf1-x136.google.com with SMTP id f18so16221444lfa.3 for ; Mon, 20 Mar 2023 12:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679338926; 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=e3Oa/LLM+RjoKh64eUURikrG2/81YhLtHPEXX0nm7Oc=; b=CP+Vdej6Ajd7SlAIFso590aZyBuKr0tAwJD3O/1VzqQL6T148bZEP7Dm11dBlDHsfO Yg7DGJh3/bbcxHfq8/Psui/HqYcZNltKhscllF1nNjRKA1fMyBcp+WCUcx93camLyIaF Ouim4oWvZ0XlVffggOSQ+Enl67V3IHi5wwdynQt6x3l6kybRR1C8zg/0J5xmBnuVVfBM RVBrTScuNL2AkbbD1zt8qp30pj7G6Z/FDFh96LWEiGZcvDMBh5zfmDcpGZnnbGT+lZ5a lR9cuaZ4LR2+xDSDGmtjkpbQdkBlt+CPdTF9whbBCYc5q42frzKYg165esHXTurDD0sa NnqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679338926; 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=e3Oa/LLM+RjoKh64eUURikrG2/81YhLtHPEXX0nm7Oc=; b=3FSRdpar/EOFAyDIKX1Dyn/PbFxP5LIa2IZOR9b1UbiWLKzzw3jkOTDg2RG6R26BHj sSpC5nRsPYF6d+ybE0c7D2OX2Qm51Yfzdi+vdxhFXzWRjuHVkc1FMrXwOJO94SKMNhp3 NB3h0TDYpAdLD7qsEYf3RpLZwUDvLOfXkoZgZXTJRY2w8Ln8DrnMEvD4N0FxVinFgvJr G26feYPReSv5oelVuaB3P4lJ+XY18e5s5r+/CmLyofgS3r+lVMUM0vPrb38yKdScl280 pWMiHvd5lwsAHFe8ADSSETMZW+2FiHPI8Hw4c0q23+9aBm3zEFXKMtamsbICApc/uvIH LT+A== X-Gm-Message-State: AO0yUKWwsIXKSZ1OP54lpxGoz/m+IJ91aLDU8V/QTneny0A5zhMCsTrB 9d7XIF7lKRyUcHvtNyyKSLA= X-Google-Smtp-Source: AK7set8vO6J+o3fGlvy0Y3DQilTn0oII+acdWDBAfP7stD1gthqJiLfqWE00wWws8L6um4mhD2zimA== X-Received: by 2002:a19:7509:0:b0:4dd:9da1:aa82 with SMTP id y9-20020a197509000000b004dd9da1aa82mr28825lfe.29.1679338925733; Mon, 20 Mar 2023 12:02:05 -0700 (PDT) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id l13-20020a19c20d000000b004d594481d0asm1823409lfc.34.2023.03.20.12.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 12:02:05 -0700 (PDT) From: Svyatoslav Ryhel To: Lukasz Majewski , Simon Glass , Ilias Apalodimas , Heinrich Schuchardt , Masahisa Kojima , John Keeping , Svyatoslav Ryhel , Maxim Schwalm Cc: u-boot@lists.denx.de Subject: [PATCH v4 1/1] cmd: ums: abort mounting by pressing any key Date: Mon, 20 Mar 2023 21:01:43 +0200 Message-Id: <20230320190143.13715-2-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230320190143.13715-1-clamor95@gmail.com> References: <20230320190143.13715-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.8 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 | 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