From patchwork Thu May 24 04:29:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 919539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="eKtGI0zy"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40rxHj2kklz9s0x for ; Thu, 24 May 2018 14:29:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 076EBC21BE5; Thu, 24 May 2018 04:29:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D033EC21C29; Thu, 24 May 2018 04:29:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 08064C21C29; Thu, 24 May 2018 04:29:44 +0000 (UTC) Received: from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) by lists.denx.de (Postfix) with ESMTPS id 03769C21BE5 for ; Thu, 24 May 2018 04:29:43 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w4O4TARZ001467; Thu, 24 May 2018 13:29:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w4O4TARZ001467 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1527136150; bh=HIeLdXml4SQ7rE4Go3u8luu3EdHSgDlEGGse1rnJcio=; h=From:To:Cc:Subject:Date:From; b=eKtGI0zyXAvVGhrT9pTAqpP7Qw3wip7GHZU3+LH+0BfBytpnrVAwroBw0qWMTSYpe sZPhzWqMbUmEjJmyUyHrbQFSLPlu4QcFTXINp0/LWrTXjNDtjMgXyZrtGQMybpwho1 715wcDPzlpV4tdtJrMirvwP3GI33HHDuY8EXm71MHi1b9p82P4pLSAUU+8i8E9j5ei JeDF8NJ04TZRcI+wJwnY6IQJ417PjxPvBevVjiS7BVYuyOi0/eVW7imiLyV3Q0WJi7 Qwh/bDWolIk+4H0T4mP2YV9pygmHe7GiBKZRVH1XGj0oo9pUNPjHqU1KJW5Rcyapi5 L+plWaI3sSKZQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 24 May 2018 13:29:06 +0900 Message-Id: <1527136146-12665-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Alexander Graf , Tom Rini Subject: [U-Boot] [PATCH] menu: fix timeout duration X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" menu_interactive_choice() divides the timeout value by 10 before passing it to cli_readline_into_buffer(). For distro-boot, the "timeout" variable in the boot script should specify the time in _seconds_ to wait for keyboard input before booting the default menu entry. Due to the division, "timeout 50" actually wait for only 5 seconds instead of 50. What is worse, "timeout 5" never breaks because "m->timeout / 10" is zero, which means no timeout. For CONFIG_MENU_SHOW case, menu_show() should also take the timeout value in seconds because its default comes from CONFIG_BOOTDELAY. The "division by 10" was introduced by commit 8594753ba0a7 ("menu: only timeout when menu is displayed"). Its log claimed "fixed", but to me, it rather looks the root cause of the problem. Signed-off-by: Masahiro Yamada --- Rob, I know commit 8594753ba0a7 is already 6 years ago. If you remember something about "/ 10", please comment. common/menu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/menu.c b/common/menu.c index bf2b471..bf23194 100644 --- a/common/menu.c +++ b/common/menu.c @@ -194,8 +194,7 @@ static inline int menu_interactive_choice(struct menu *m, void **choice) if (!m->item_choice) { readret = cli_readline_into_buffer("Enter choice: ", - cbuf, - m->timeout / 10); + cbuf, timeout); if (readret >= 0) { choice_item = menu_item_by_key(m, cbuf);