From mboxrd@z Thu Jan 1 00:00:00 1970 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 1D24CC46467 for ; Sat, 7 Jan 2023 22:55:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A2FA85215; Sat, 7 Jan 2023 23:55:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kMlWR+A+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 72A5885215; Sat, 7 Jan 2023 23:55:00 +0100 (CET) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 DA91B85369 for ; Sat, 7 Jan 2023 23:54:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ed1-x52d.google.com with SMTP id v10so5936060edi.8 for ; Sat, 07 Jan 2023 14:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=knwjXapJ0EVKKpFhEsLVo2m0NqF0fdWYSGss6hIGDzM=; b=kMlWR+A+wKfrJF/MmpyF9VCSXEivtLzQ7qkCRJ1VjDHnGovUj9UTTH8amnnRl+Ewr8 08qKOHs1bdCfU2CfQ5I5buLErB2eztKnFMZO9gqomofjb4RJXEOPuVJc19gILinnsiQh F8liJXeddImavhF3RIiL78zp3d66lCpW353tM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=knwjXapJ0EVKKpFhEsLVo2m0NqF0fdWYSGss6hIGDzM=; b=rZ8NlryozhvLY2xSLog1HCrVS5lyVvcChXTlyFZ+eYd4jPYvQjYSzlG0bb2uENblrF IMC70Y1MJXCGaY6NmzGQ9UFtOo76OhPWlfkylW9KFgwtolziS/GgvIWwZDAm6xCyU5Kg LTesEaoCFqlNBVRGHaThDX7SuRHHTvGQ3ynA5I3Q2STPp0yAlf1aBC2gZNyUl8VGiKV/ ZI1sMEoZ+zTqp6hLLKZLiw03PgJw2Q16Cur35WsBydsr+nQ/tuogtiKje+aKvEV/1xQV jR10Y9gpqiVLcasObpDyWa5FSP9XJnrzbNd0Yg4Zk5K0aRg0ivpkOq4+0vrEdRoqtcNm L+Mw== X-Gm-Message-State: AFqh2krtrjE1X4e8AO+0ThE+lzNij36pCP8eZtxDnRipmWmAYbNo9EOu 6GpD4Xoc+X3rnb0c08Oe9jE9g091m3sOThsxNI308A== X-Google-Smtp-Source: AMrXdXs9rL+7QnQuOPEnn3UcErYMHyZSxriOQZHgEiPGh7Au9G/0znW18zpKYNOckdsHJuIxdNWj8r6hTVnynitUS0o= X-Received: by 2002:a05:6402:530c:b0:472:9af1:1f72 with SMTP id eo12-20020a056402530c00b004729af11f72mr7612813edb.283.1673132096193; Sat, 07 Jan 2023 14:54:56 -0800 (PST) MIME-Version: 1.0 References: <20230106145243.411626-1-sjg@chromium.org> <20230106145243.411626-4-sjg@chromium.org> <05842fd7-0b91-7fed-bf71-d64f9607cf64@gmx.de> <5d50cf5d-017a-de88-c05b-07df2431ab60@gmx.de> In-Reply-To: <5d50cf5d-017a-de88-c05b-07df2431ab60@gmx.de> From: Simon Glass Date: Sat, 7 Jan 2023 15:54:43 -0700 Message-ID: Subject: Re: [PATCH v3 03/25] bootmenu: Add a few comments To: Heinrich Schuchardt Cc: Anatolij Gustschin , Tom Rini , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" 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 Hi Heinrich, On Sat, 7 Jan 2023 at 15:35, Heinrich Schuchardt wrote: > > On 1/7/23 01:13, Simon Glass wrote: > > Hi Heinrich, > > > > On Fri, 6 Jan 2023 at 09:53, Heinrich Schuchardt wrote: > >> > >> On 1/6/23 15:52, Simon Glass wrote: > >>> The behaviour of these two functions is completely undocumented. Add some > >>> notes so the poor, suffering dev can figure out what is going on. > >>> > >>> Signed-off-by: Simon Glass > >>> --- > >>> > >>> (no changes since v1) > >>> > >>> include/menu.h | 42 ++++++++++++++++++++++++++++++++++++++++++ > >>> 1 file changed, 42 insertions(+) > >>> > >>> diff --git a/include/menu.h b/include/menu.h > >>> index 702aacb170c..0b4d9734149 100644 > >>> --- a/include/menu.h > >>> +++ b/include/menu.h > >>> @@ -42,6 +42,7 @@ struct bootmenu_data { > >>> struct bootmenu_entry *first; /* first menu entry */ > >>> }; > >>> > >>> +/** enum bootmenu_key - keys that can be returned by the bootmenu */ > >>> enum bootmenu_key { > >>> KEY_NONE = 0, > >>> KEY_UP, > >>> @@ -53,8 +54,49 @@ enum bootmenu_key { > >>> KEY_SPACE, > >>> }; > >>> > >>> +/** > >>> + * bootmenu_autoboot_loop() - handle autobooting if no key is pressed > >>> + * > >>> + * This shows a prompt to allow the user to press a key to interrupt auto boot > >>> + * of the first menu option. > >>> + * > >>> + * It then waits for the required time (menu->delay in seconds) for a key to be > >>> + * pressed. If nothing is pressed in that time, @key returns KEY_SELECT > >>> + * indicating that the current option should be chosen. > >>> + * > >>> + * @menu: Menu being processed > >>> + * @key: Returns the code for the key the user pressed: > >>> + * enter: KEY_SELECT > >>> + * Ctrl-C: KEY_QUIT > >>> + * anything else: KEY_NONE > >>> + * @esc: Set to 1 if the escape key is pressed, otherwise not updated > >>> + */ > >>> void bootmenu_autoboot_loop(struct bootmenu_data *menu, > >>> enum bootmenu_key *key, int *esc); > >>> + > >>> +/** > >>> + * bootmenu_loop() - handle waiting for a keypress when autoboot is disabled > >>> + * > >>> + * This is used when the menu delay is negative, indicating that the delay has > >>> + * elapsed, or there was no delay to begin with. > >>> + * > >>> + * It reads a character and processes it, returning a menu-key code if a > >>> + * character is recognised > >>> + * > >>> + * @menu: Menu being processed > >>> + * @key: Returns the code for the key the user pressed: > >>> + * enter: KEY_SELECT > >>> + * Ctrl-C: KEY_QUIT > >>> + * Up arrow: KEY_UP > >>> + * Down arrow: KEY_DOWN > >>> + * Escape (by itself): KEY_QUIT > >>> + * Plus: KEY_PLUS > >>> + * Minus: KEY_MINUS > >>> + * Space: KEY_SPACE > >>> + * @esc: On input, a non-zero value indicates that an escape sequence has > >>> + * resulted in that many characters so far. On exit this is updated to the > >>> + * new number of characters > >>> + */ > >>> void bootmenu_loop(struct bootmenu_data *menu, > >>> enum bootmenu_key *key, int *esc); > >> > >> This should not be an exported function. The program part that wants to > >> display a menu should not have to deal with navigation keys. > > > > This is a patch to add comments to code which is not otherwise > > addressed in this series. We need comments so that we know what things > > do. We can always adjust the logic later. > > > > My intent with this series is to add a new menu which is more flexible. > > We should take care that the new menu is not using this design. > Yes, the new menu does not use any of the code here. This patch is purely to add comments. I wonder whether the expo menu might eventually replace the current menu, since the expo one does support text mode too. > > This series should be of interest for you too: > > https://patchwork.ozlabs.org/project/uboot/list/?series=335054 > eficonfig: add vertical scroll support and refactoring OK ta. Scrolling is another thing not supported by expo. Regards, Simon