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 D5ADDC46467 for ; Sat, 7 Jan 2023 22:35:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 73B5D85355; Sat, 7 Jan 2023 23:35:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de 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; secure) header.d=gmx.de header.i=@gmx.de header.b="YCjINwbK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC2C785494; Sat, 7 Jan 2023 23:35:02 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7E7E28533F for ; Sat, 7 Jan 2023 23:34:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1673130898; bh=JSuR9nhXFfwUza76hIFHZtEGXoY/jZwxWoncrtiysrM=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=YCjINwbKEpO6/5DtSQDtVdQqBXBjcSNa6Oc5eycPOmunQ3thEtASy42njC7N3/fZj IEa6a/E7PpHLenNED8JsZUtLP2mUfF+RlvUdIN21BUHWqylZ6UITYtrWSwDJb4wxbJ zTPsK6B8PbkI/w7hJTqfiMQ6T2C7gjIrtqxr/rT9N6LBpp2R86RiM5qXitSbUb2bRb slf1HYLUt5Yc4ISE/I69QHHdPvUm0wE3eQC10Wr80t0hCL0IG2++WNelyE1GApzB6r nIiCE2A5kLcK4CHSlqA/raOz5omAHYkI1oFF4W0s3BsuhAWNNJAJX9q6K/crjGZn/g AWHHXRkZe9kUw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.123.94] ([88.152.145.137]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MYeR1-1pIpyE3mNv-00VeNi; Sat, 07 Jan 2023 23:34:57 +0100 Message-ID: <5d50cf5d-017a-de88-c05b-07df2431ab60@gmx.de> Date: Sat, 7 Jan 2023 23:34:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v3 03/25] bootmenu: Add a few comments Content-Language: en-US To: Simon Glass Cc: Anatolij Gustschin , Tom Rini , U-Boot Mailing List References: <20230106145243.411626-1-sjg@chromium.org> <20230106145243.411626-4-sjg@chromium.org> <05842fd7-0b91-7fed-bf71-d64f9607cf64@gmx.de> From: Heinrich Schuchardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:s4kS7oi15/clZuVzOiVIGhNz9zTIVrNwbX1b/PFvkxhpiALAJwh uGRiNU2CMYwHMA8JBI2UYGwYhB21fWRiOHsYhN1UY+0t3Q1hbtkvwy1bxoCEHaavEGjjTvH cM0QlhxfaLZeCdw4DPCGvB53JBF9UuzQwkcKZnV8illQ1+QCe6AT/UZrQ/lypjQEso3A0xr lM8AyQ5Q7a/k6ZnOqmZDA== UI-OutboundReport: notjunk:1;M01:P0:1EPz5EcpCMw=;kCbK56qORkCUb6T2/jP2FXJBVmS sKvU/X0WxMXzdzs44wUhZgHHxQz0hz7A7o+yCgBkreevIXPazg4kyYyE8Mxtt/0wKCB5zKSaD JjEqlUd9DyTj8EZoa/focgeLv0hSc5u7lZjAvtrKAEqCb032oIedlwlNZaiEJ8CfwlSos/OKl wU+Q5Twm9f3aHK7bGYw5PrjlhcZ1v5IvB86WF01o9sy8ENB7WIqSkYKzUWoyQEslbSRQan3bd PrHlNZ36chtpJRzWqPxbOujYcbe7qtlyRPEdoHzG65xsjuzLBE121sRvAoenLLoCqExNuodcq pZoeDRvludLLMNO2Al/mUf1xWZUCg2kSPHQjeWQK2+vuNiLw7e/jLMimZYFBP6EvadyiOTP9a xSY0K4uUxpXdibEX0rwrB15vlpO8duaU/7qMtXhaj6GpPxWiazQ3Wr/4SvopGgqMDggEJhA+K spsbu0D3IEqEwtqzRksRR8lrQ2ILhZprYvQ8rsMDqZxcaDa8IR9xQMXtvyeQOwvpZiPAzp8KA cKXGl13T7lQRxgm/IHFyKCo9+HpmAKo9RtMUpZeM+7RWpoNFZdqhzbtVT0qVcCfq8OwOSVgTc 9Nzle19L5I2cDhYaol5kyjk6ulvJH7nwOxmObodhtk9JIPYL4OVOEmKmiHWlwh3FbYOCyCxch dT7sNLj97Tr9eLsdh2yOesiuf66swgxYcGDrHMHaEBPrcsghUDcZ9tOrRjqNPg518M0Kx57LN s18cX5rGaoQOgYrzMi8Rb0ccrvX1Lr7QcMRKHvTDB5iCmhstuDq4CWGePflq0g3cOdZNLGcZh yB6vmJAfHRKkKqx/BRLHqxI2oWDzYexLTVmepC5fyiG85N13kTb+gu93J0/nF30zfChe6lUE3 xN04vM6UvZsGkzYh+d8UxKtR294aBPcOHb62y3oF31HtQYtdTCbyIfJoU926qga+cHhB+Po/z 8sRhxw== 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 On 1/7/23 01:13, Simon Glass wrote: > Hi Heinrich, > > On Fri, 6 Jan 2023 at 09:53, Heinrich Schuchardt wr= ote: >> >> On 1/6/23 15:52, Simon Glass wrote: >>> The behaviour of these two functions is completely undocumented. Add s= ome >>> 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 =3D 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_SELE= CT >>> + * 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 d= isabled >>> + * >>> + * 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 i= f 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. > > Regards, > Simon This series should be of interest for you too: https://patchwork.ozlabs.org/project/uboot/list/?series=3D335054 eficonfig: add vertical scroll support and refactoring Best regards Heinrich