Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iFpOb-0003rz-L3 for mharc-grub-devel@gnu.org; Wed, 02 Oct 2019 20:55:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40539) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFmTs-0000zU-7M for grub-devel@gnu.org; Wed, 02 Oct 2019 17:48:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFmTr-00088O-0F for grub-devel@gnu.org; Wed, 02 Oct 2019 17:48:19 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFmTq-00087M-QJ for grub-devel@gnu.org; Wed, 02 Oct 2019 17:48:18 -0400 Received: by mail-wr1-x434.google.com with SMTP id r5so602556wrm.12 for ; Wed, 02 Oct 2019 14:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=akaNOzOZz/d+PZWgDDOIDo0WhUktBHZD1DJMLQeObBs=; b=UpclF/cySB44OhgsngtUCG42xirCp1ov3Odj3NvmcY+D6hF1QnRA+fSEI1nnXRVXTV +ApiALaqMHS3UeglJOyj+E4myWqv6B5VVph8NtjMeA5jotZ91idzh19WLxKk3DsDNGtK zrzj8EK+eKkXLO7Oz81Tnevu0TQKBOiTgNRufBgtI1sZIt1x619SmZgRSq1MkperKnSF GcfL9elr7z+DVJviCHQKiKUszMXobbG3KzJZHsR94us3dwCRCwH/e95HMa8028844Q69 MknpkHthAYv8S53dUWEiRSWqjEavVqjE0HL9diTQFoAQYX9YiG25Y77vYX2k1DL58pA6 Pn3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=akaNOzOZz/d+PZWgDDOIDo0WhUktBHZD1DJMLQeObBs=; b=MHFVKY/ZglnNAASpbEZkPiOOstzXGl2n34uWxJ9HX83TR3UwfmVHYdTW3y6k2Wz/YS Izqs4sI0JFj3fB/YYug+OysJZ/NBhSSfWGMSz4+vp2RQ+1xLmad4HjhmBivt5xsHcexe B0A+7MiJYM6VAMsA8PrMSNjHTUH3NpOGXD9XOdERuE5j56VNxEGJBpeWLBL2PZuxr7JW oebJCpnmJZYcawh1Dc10fhLR7Ypq+Dv6GrsAQctFyQzt5pPFAi7aTb3eODE425QPSSWr EHrUzlP+wb393R8rHAFYloiRV+96I/Ap1cTkC58NqT6WyDvcGTrFcbTF20CmTyWJ4xOk /PtA== X-Gm-Message-State: APjAAAV3AYEauH7Qlgpqu8krgY+lBbYig4EtDEaN9HKPhkUyiWoCymzq F7C2mBTumY1OClIMHtt/dlnveBoW5fS2Kw== X-Google-Smtp-Source: APXvYqwWcGM4vZdoFlJIQxMl4+9ghfXXvWRPHStLmRFKIOWDWJ94ELamu/I1ykWWajORxUzWQw17jw== X-Received: by 2002:a5d:4944:: with SMTP id r4mr4165563wrs.283.1570052896602; Wed, 02 Oct 2019 14:48:16 -0700 (PDT) Received: from localhost.localdomain (143.224.15.109.rev.sfr.net. [109.15.224.143]) by smtp.gmail.com with ESMTPSA id f143sm932950wme.40.2019.10.02.14.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 14:48:16 -0700 (PDT) From: Michael Bideau To: grub-devel@gnu.org Cc: Michael Bideau Subject: [PATCH] at_keyboard: fix unreliable key presses Date: Wed, 2 Oct 2019 23:48:10 +0200 Message-Id: <20191002214810.21347-1-mica.devel@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 X-Mailman-Approved-At: Wed, 02 Oct 2019 20:55:05 -0400 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Oct 2019 21:48:21 -0000 This patch fixes an issue that prevented the 'at_keyboard' module to work (for me). The cause is a bad/wrong return value in the function 'grub_at_keyboard_getkey()' in file 'grub-core/term/at_keyboard.c' at line 237. My symptoms were to have an unresponsive keyboard: keys needed to be pressed 10x and more to effectively be printed, sometimes generating multiple key presses (after 1 or 2 sec of no printing). Very problematic for typing passphrase in early stage (with GRUB_ENABLE_CRYPTODISK). When switching to 'console' terminal input, keyboard works perfectly. It also worked great with grub 2.02 packaged by Debian (2.02+dfsg1-20). It was not an output issue, but an input one. I've managed to analyse the issue and found where it came from: the following commit: ///////// commit ///////// Commit: 216950a4eea1a1ead1c28eaca94e34ea2ef2ad19 Author: Vladimir Serbinenko Date: Mon May 8 21:41:22 2017 +0200 at_keyboard: Split protocol from controller code. On vexpress controller is different but protocol is the same, so reuse the code. ///////// end of commit ///////// 3 lines where moved from the function 'fetch_key()' in file 'grub-core/term/at_keyboard.c', to the begining of function 'grub_at_keyboard_getkey()' (same file). But returning '-1' made sense when in function 'fetch_key()' but not anymore in function 'grub_at_keyboard_getkey()', which should return 'GRUB_TERM_NO_KEY'. I think it was just an incomplete cut-paste, missing a small manual correction. Better fix it. --- grub-core/term/at_keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c index f0a986eb1..597111077 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -234,7 +234,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) return GRUB_TERM_NO_KEY; if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) - return -1; + return GRUB_TERM_NO_KEY; at_key = grub_inb (KEYBOARD_REG_DATA); old_led = ps2_state.led_status; -- 2.20.1