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 7BF2DC54EAA for ; Thu, 26 Jan 2023 19:37:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 266FE855B5; Thu, 26 Jan 2023 20:37:38 +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="W+VBAbxg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1440B856F6; Thu, 26 Jan 2023 20:36:10 +0100 (CET) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 B9DAB85528 for ; Thu, 26 Jan 2023 20:35:57 +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-ej1-x636.google.com with SMTP id hw16so7869293ejc.10 for ; Thu, 26 Jan 2023 11:35:45 -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=WsxK3BVKZQM3SwNJtojN8cQ4+IQXpr9LksWPdsQA54s=; b=W+VBAbxgJgxWER/K/UusfB7yJG5KDCUH7YbhW6ZOwzE4W4MaL43LmuU1V/WCXQ53rZ vg0XHtBcFyxQb7vQHkFjzCdH4UznLN5C1MxUbWPRsrmdKtC7nEgd/px2/8muFmtR9SxK alxfZBOL8B/MpDbKAfWwNe80N2qgNWcOeNm752HLqKsjkhnheHaxyINlvih8YYs6vmzP 4inj0rRJDxoeckhXQZtDiKN9aNzlB46GlENHMI0k/alANAOkjRwMLiubaWztOamnGWhH BFi9CpRNrgrclm2aLR//GHrw0TgCnfQYzrOSEv8Hc3samTDme3eUGDpLK0CIK8PN5MzR 7ZHQ== 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=WsxK3BVKZQM3SwNJtojN8cQ4+IQXpr9LksWPdsQA54s=; b=r17F/Vu22cfqMOxVYwzDKzMT3KKoLdkkZIJHoY8KHSaiI9BOgm1ALOFdxbt74BeXKl XCAWWcSt/wApsMDX3a8jAbS622HZuvk3Uwt8DG+tRMyI4XJ3G0h7cMD4EwdGE7wO4u3e VcTicsSZtXdC8zpSG0VdYkxOf72nhsFA4r2CGbaEogx37lziaR4F6XvsOAmo5XfIOM/y dwriBp4C/0utQdiGEOJDrcWfAEDPH9M734vF+i2ZR90+ajUC5b70Hm6cArIplKlELZoJ 4rBWbsLTpZpyG/135o42skp/8ABWODsIgVu4RoZfmkSJskTXq3kTICbiFsvoL0kc4bNs 8MNQ== X-Gm-Message-State: AO0yUKUqmudRnfncs3nWu+MV0/TE26BisRf2XVUcYUIf8CJVqRaJBX2B UGLAiK5qWSwchVkVIvu4XhQ= X-Google-Smtp-Source: AK7set/lEwmcbNZTnN0oeF0cuuVUnPP0T0WI4rPrZJHmXN6m2GK/83YQYiPLpy7ydFYOTyTGjkh3wA== X-Received: by 2002:a17:906:d0c2:b0:878:5fdc:3850 with SMTP id bq2-20020a170906d0c200b008785fdc3850mr3507376ejb.48.1674761740760; Thu, 26 Jan 2023 11:35:40 -0800 (PST) Received: from DESKTOP-BE01SG2.localdomain ([91.204.85.69]) by smtp.gmail.com with ESMTPSA id ay9-20020a170907900900b00738795e7d9bsm1026214ejc.2.2023.01.26.11.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 11:35:40 -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 v2 1/1] cmd: ums: abort mounting by pressing any key Date: Thu, 26 Jan 2023 21:35:08 +0200 Message-Id: <20230126193508.334-2-clamor95@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126193508.334-1-clamor95@gmail.com> References: <20230126193508.334-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..47d882e62f 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 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..8a758b5884 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_CMD_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