From patchwork Thu Apr 28 08:09:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 567132 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp5232979map; Thu, 28 Apr 2022 01:12:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyty2uA1OXwqVDUFVShl0LSjupacY5HHeGyKll91yIBBYSXiPF5CgF1tc1uVYe1dCAAxLeX X-Received: by 2002:a05:6402:524e:b0:423:e919:8eb4 with SMTP id t14-20020a056402524e00b00423e9198eb4mr35061256edd.153.1651133539619; Thu, 28 Apr 2022 01:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651133539; cv=none; d=google.com; s=arc-20160816; b=n+CGF5mFqETG4cDc0HP5RRhjsV9nWmkG8wrt906Xrc5/c1jJn2G5upjqwkDe+PWj/8 C8lVb//3o9aw54uK/DLHIFCpDZbxQlaj52shsBg/HI3jxJTOAyFPL+xfTwLqmaIAOyEk TxGclK/RkntxU/Y7bhq6inrRvf+RHDk1LC9jkoioiCOoNc4RpmF0muR31FdusD4KZQfm ib4v5wwXfXfQgDz+C5uRvJiEeSBrmTpuJOHvcQzlaid9tMd6z1bl/IQT0HEHgJ1LCK2b ZqbkGe9fUnYpqG93zt+qvlMDDGg7eX2nFrV+u68M14u0Q3c43u8APcJWfP1gY0FUbIoC 9vyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0d5XzgIT22LtcbfvaH5xwq+RVmN2SJ3ZzE3Sh0PRB00=; b=jUVhBr5+4PbeaCPsSLrY0EOGIjnlwbp4l62Z/7BkFLhcFxgS1DWPggLcITmjCdG2gv 3CRjSmQvECy68qD6Z5oXAsluFHQ0BvfOzhsSP6cIxaoT9ZXN6tn3kV01Wxq4eSIhJwSg Jn/kAtR46VTRqOyjvYIz3POS93hnQBqLpRbWwjv9NjCU4STiCNW9fLK/3e5PHaHdbvrp gk+1GBE77frdn6GtRGdgCsFxWzL507Gr88kiQmjjdJSGVYdG2VAGWe9Po2Ft4L6TK/5j 3gd/pPe9dv3paVS3a0vFafD9y9gqpOAAg3Ve8YbIYHicn5Hh5hJ2Y9ZupVUeQNqUn+Av trCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xr/E8U1d"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id sd22-20020a170906ce3600b006e12386caa3si3180403ejb.748.2022.04.28.01.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 01:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xr/E8U1d"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ED8D883ECB; Thu, 28 Apr 2022 10:11:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="Xr/E8U1d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 168C283ED1; Thu, 28 Apr 2022 10:11:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (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 46D4B8393F for ; Thu, 28 Apr 2022 10:10:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pl1-x633.google.com with SMTP id b12so3696943plg.4 for ; Thu, 28 Apr 2022 01:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0d5XzgIT22LtcbfvaH5xwq+RVmN2SJ3ZzE3Sh0PRB00=; b=Xr/E8U1dc4jPqfOpSeuTY8OdYZltpQZXodr/zyufV+Qon4ZP2Hrf4cDV8nRychZ23g j9tIu6Upw6UUQiidibwrLIheMNjx8g/WyEAiUZ6JyM73V1R6hdHFgn6GQZ34BkN57Btm 8MG6QuusHjkga81si3WsuokLjgr38IhyWsXrW+Q4NiXwCdW1ZQIUwoGRibXxRovcOoJk L16cYCQNmR+DrkmU0X3vG/9x9P27n+8BtDuyjpurPiawDFo/unpkCNp/8v+rDh+TPmdN Ht0qjsE5/KJHdMV4DiLyAB7ELI5num197B8SWd4NgFzapf5HToQOcS2lAcMtRoYe3EZW T9EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0d5XzgIT22LtcbfvaH5xwq+RVmN2SJ3ZzE3Sh0PRB00=; b=wRTMjF4hhtl+kyYEcP+e5I5PuIBBC9J1W07yFdZUMkNtINKXxK4lPyEEmZFNBKDbNQ nFJSA92bhJI/UHpyn0SilGta8oH9GL+4KHB2+dzNUr6mLUHaUlmHdZWevuXxVZSi3Eyb 3/0pSG0AXVYyreelJGVsWURtqBGfKZXuPAJYK3H0hq0cqcDDck3CEmn3yFioVCJ3oTXg WJTzXotbcc1XrPcv4W/sHA3suI4X2QVrdyX3nAj8WFI7slVI6WfQrpOh9p1kBsS4AixW iQnainf7kKPQS1aN7J/jWT90ukmt3ZiF0SlHT1cD/xk2izBwDSb9RJeKQ4yjkZPd3yvq +qSg== X-Gm-Message-State: AOAM53305W3PB9RwQEGQTK/yV7Ymdeye7yP1jq9DFC7vxwuViXOjih5r WCmDSmpYBoKgBDXeI10mb0sonIT72Tkttg== X-Received: by 2002:a17:90a:8044:b0:1d9:7a6c:38dd with SMTP id e4-20020a17090a804400b001d97a6c38ddmr21791517pjw.156.1651133455653; Thu, 28 Apr 2022 01:10:55 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id b15-20020a17090a7acf00b001cd4989ff5fsm5684259pjl.38.2022.04.28.01.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 01:10:55 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Francois Ozog , Mark Kettenis , Masahisa Kojima Subject: [PATCH v5 07/17] bootmenu: flush input buffer before waiting user key input Date: Thu, 28 Apr 2022 17:09:40 +0900 Message-Id: <20220428080950.23509-8-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220428080950.23509-1-masahisa.kojima@linaro.org> References: <20220428080950.23509-1-masahisa.kojima@linaro.org> 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.5 at phobos.denx.de X-Virus-Status: Clean Before waiting user key input to stop autoboot, the input buffer must be flushed. Signed-off-by: Masahisa Kojima --- Change in v5: - newly created, split into separate patch cmd/bootmenu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index d573487272..9a32a18b19 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -87,6 +87,10 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu, int i, c; if (menu->delay > 0) { + /* flush input */ + while (tstc()) + getchar(); + printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); printf(" Hit any key to stop autoboot: %2d ", menu->delay); }