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 13C27C636CC for ; Wed, 15 Feb 2023 15:49:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 08A0C859FD; Wed, 15 Feb 2023 16:49:16 +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="dFmQmyrY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15363858ED; Wed, 15 Feb 2023 16:48:52 +0100 (CET) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 2CA51859ED for ; Wed, 15 Feb 2023 16:48:48 +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-x429.google.com with SMTP id by3so18300328wrb.10 for ; Wed, 15 Feb 2023 07:48:48 -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=8nHv73nPy2L5ASFhdyTsxOaJlPkyLjx0hniD8Z7L7Wg=; b=dFmQmyrYpmUFWjE1/jbE2tGhh8K/TqLucAVRSiCE3hYuDWfwrEOm6YVHIfU1SCgG5I I1AGOBdydEcMfX3TdH12LhyjsG07Ofh4dzRxJJuSoGs7NSWNm6BLYtp/6K7OJ/jgx/Fq FN5xZcaSvWlU3azAgXx183jyDShLxvT3Aajd1wVGT/vrSErR4zpQ4gZDP8Kte832NeVr ZenKxMN3jegRxmFWfReDnGMcyUwQ7jLC/uBsyO9Y4GvoyXW1K0py1Y1Lbj64vwd6zpO3 pmFTkEY5W+pveNNeFIiIstscLdeiZMVllG92lyqElShtU8Rx6Nj5xPh+HesB/aTS3GQr 2Ilw== 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=8nHv73nPy2L5ASFhdyTsxOaJlPkyLjx0hniD8Z7L7Wg=; b=uRlGGqi1r+bKelTJ1QZkiCMihugUmy/z+wTtRJ1vOvw8TDH70e51mqbBUd5msG4gRC K56BMMCQMwY903XIOkK1UPdF45NnOmk4wEVFxwYDdwdEy+7Y6H+rse9eWFTa+3kcsI4m D7sTy8T6izCW6d81kayBa3qoEA6WHp5YU95KQDHd6zzvv1Tb0Jc7w8RCZ9O/B1THiUR8 xl43nIKUdUGplEWYSUv2jdRIPDwEORh3L39lxbuvcSMMrZuQcIWm84rDrWe2ndoy/l9/ niQwrUKiKDOwLEGeI9z+kQ8tCHhCRCIBzxUWgN1RgpagwFwXSXASCLrabdE6T1/QnXcB 2bLw== X-Gm-Message-State: AO0yUKUKpEKnZypc0cFX6YS+B1uQmp4nvYqmGRLABJyhJyyP+Timavvj Uun7I3vdB73Lq96l5TgFaeU= X-Google-Smtp-Source: AK7set/gGSnpBnbpBsr2+JIHtRfhCwrex+aIiSKtoGZvZb0WjRhTQc5FwuxbQzHBvoEuZhfGrShS3Q== X-Received: by 2002:adf:d4c7:0:b0:2c5:5ed0:7aaf with SMTP id w7-20020adfd4c7000000b002c55ed07aafmr2210878wrk.19.1676476127560; Wed, 15 Feb 2023 07:48:47 -0800 (PST) Received: from DESKTOP-BE01SG2.localdomain ([91.204.85.69]) by smtp.gmail.com with ESMTPSA id m22-20020a05600c3b1600b003daf6e3bc2fsm7280162wms.1.2023.02.15.07.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 07:48:47 -0800 (PST) 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 v3 1/1] cmd: ums: abort mounting by pressing any key Date: Wed, 15 Feb 2023 17:48:11 +0200 Message-Id: <20230215154811.214-2-clamor95@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230215154811.214-1-clamor95@gmail.com> References: <20230215154811.214-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 | 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.25.1