From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1grLi9-0003bc-91 for mharc-grub-devel@gnu.org; Wed, 06 Feb 2019 06:49:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grLi7-0003ZU-RX for grub-devel@gnu.org; Wed, 06 Feb 2019 06:49:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grLi5-0005Oa-KM for grub-devel@gnu.org; Wed, 06 Feb 2019 06:49:47 -0500 Received: from dibed.net-space.pl ([84.10.22.86]:45135) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1grLi3-0005Mn-Je for grub-devel@gnu.org; Wed, 06 Feb 2019 06:49:45 -0500 Received: from router-fw.i.net-space.pl ([192.168.52.1]:40054 "EHLO tomti.i.net-space.pl") by router-fw-old.i.net-space.pl with ESMTP id S1846030AbfBFLth convert rfc822-to-quoted-printable (ORCPT ); Wed, 6 Feb 2019 12:49:37 +0100 X-Comment: RFC 2476 MSA function at dibed.net-space.pl logged sender identity as: dkiper Date: Wed, 6 Feb 2019 12:49:34 +0100 From: Daniel Kiper To: Paul Menzel Cc: grub-devel@gnu.org, coreboot@coreboot.org Subject: Re: [PATCH] normal/menu: Do not treat error values as key presses Message-ID: <20190206114934.oqvqxlpx7diioasa@tomti.i.net-space.pl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: QUOTED-PRINTABLE In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 84.10.22.86 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2019 11:49:48 -0000 On Tue, Feb 05, 2019 at 05:29:13PM +0100, Paul Menzel wrote: > Date: Sat, 4 Feb 2019 22:39:37 +0100 > > Some terminals, like `grub-core/term/at_keyboard.c`, return `-1` in c= ase > they are not ready yet. > > if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) > return -1; > > Currently, that is treated as a key press, and the menu time-out is > cancelled/cleared. This is unwanted, as the boot is stopped and the u= ser > manually has to select a menu entry. Therefore, adapt the condition t= o > require the key value also to be greater than 0. > > `GRUB_TERM_NO_KEY` is defined as 0, so the condition could be collaps= ed > to greater or equal than (=E2=89=A5) 0, but the compiler will probabl= y do that > for us anyway, so keep the cases separate for clarity. > > This is tested with coreboot, the GRUB default payload, and the > configuration file `grub.cfg` below. > > For GRUB: > > $ ./autogen.sh > $ ./configure --with-platform=3Dcoreboot > $ make -j`nproc` > $ make default_payload.elf > > For coreboot: > > $ more grub.cfg > serial --unit 0 --speed 115200 > set timeout=3D5 > > menuentry 'halt' { > halt > } > $ build/cbfstool build/coreboot.rom add-payload \ > -f /dev/shm/grub/default_payload.elf -n fallback/payload -c l= zma > $ build/cbfstool build/coreboot.rom add -f grub.cfg -n etc/grub.c= fg -t raw > $ qemu-system-x86_64 --version > QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-2+b1) > Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project deve= lopers > $ qemu-system-x86_64 -M pc -bios build/coreboot.rom -serial stdio= -nic none > > Currently, the time-out is cancelled/cleared. With the commit, it is = not. > > With a small GRUB payload, this the problem is also reproducible on t= he > ASRock E350M1. > > Link: http://lists.gnu.org/archive/html/grub-devel/2019-01/msg00037.h= tml > Signed-off-by: Paul Menzel Reviewed-by: Daniel Kiper Daniel