From patchwork Thu Oct 23 11:33:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 39350 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C896324022 for ; Thu, 23 Oct 2014 11:34:20 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf726277eek.6 for ; Thu, 23 Oct 2014 04:34:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=BsHKNGKv1LIpbcIgLttwcvLClUpevc3ou2eH6YBPGFk=; b=jKwoLJtBj2pDOKShbl+nZ0ULoLe2XT7k1nJdGiz9nyqYgAhQ6CJ72Q6krn+gqOEf2k CHucP1PV1IHJyIW39yOufuuSWJQIkW5LSY7JoQjDVE5jsFsMj7UD43lEBWfinDJZ1uJA +2PJ26oo0e4oE23/ch4lT5TAIEQBgG7SW0+uOQob28Z2E1HZRUwpLuzG50KKjippFfYD NyOVpnvxLOnBBY3USoRdrpeK9dfkGJitAMWrvK9issVJj86wySf2VFslSFmNPUEoBT08 XKBHFmdv2NPRfkPYtzj6TRVEvI0th3jJJo6lOTvawucZ2etdsJ8xDSTTg7bnSMTVzf5i tGbg== X-Gm-Message-State: ALoCoQkeAcLBhckLxnsUxtm2R9Y4XJhI3I8TKX7sApts7+TNBN2nzfq4NwC/cakogtiZNa8ux8y/ X-Received: by 10.112.166.2 with SMTP id zc2mr1815lbb.24.1414064059920; Thu, 23 Oct 2014 04:34:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.98 with SMTP id k2ls300224lag.15.gmail; Thu, 23 Oct 2014 04:34:19 -0700 (PDT) X-Received: by 10.152.179.164 with SMTP id dh4mr4347936lac.55.1414064059755; Thu, 23 Oct 2014 04:34:19 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id x6si2140259lbo.81.2014.10.23.04.34.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 04:34:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so646547lbv.38 for ; Thu, 23 Oct 2014 04:34:19 -0700 (PDT) X-Received: by 10.152.116.102 with SMTP id jv6mr4491965lab.40.1414064059633; Thu, 23 Oct 2014 04:34:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp238292lbz; Thu, 23 Oct 2014 04:34:18 -0700 (PDT) X-Received: by 10.43.76.199 with SMTP id zf7mr1833064icb.57.1414064058363; Thu, 23 Oct 2014 04:34:18 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id x25si1750824ioi.93.2014.10.23.04.34.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 04:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XhGee-0002IG-Pq; Thu, 23 Oct 2014 11:34:08 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XhGee-0002IB-54 for edk2-devel@lists.sourceforge.net; Thu, 23 Oct 2014 11:34:08 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=lersek@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1XhGec-0005Ll-9p for edk2-devel@lists.sourceforge.net; Thu, 23 Oct 2014 11:34:08 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9NBY0kC019316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 23 Oct 2014 07:34:00 -0400 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-105.ams2.redhat.com [10.36.116.105]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9NBXtPU027262 for ; Thu, 23 Oct 2014 07:33:58 -0400 From: Laszlo Ersek To: edk2-devel@lists.sourceforge.net Date: Thu, 23 Oct 2014 13:33:42 +0200 Message-Id: <1414064030-11029-2-git-send-email-lersek@redhat.com> In-Reply-To: <1414064030-11029-1-git-send-email-lersek@redhat.com> References: <1414064030-11029-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Spam-Score: -2.9 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1XhGec-0005Ll-9p Subject: [edk2] [PATCH v2 1/9] IntelFrameworkModulePkg: BdsDxe: factor HandleKeyPress() out of ShowProgress() X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In the next patch we'll reuse this chunk of code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- Notes: v2: - new in v2 .../Universal/BdsDxe/FrontPage.c | 57 ++++++++++++++++------ 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index f69b17c..219f691 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -868,6 +868,46 @@ WaitForSingleEvent ( return Status; } + +/** + Assuming that the user pressed a key, process that key. + + @retval EFI_TIMEOUT User pressed "Enter", which is equivalent to selecting + "Continue". + + @retval EFI_SUCCESS User pressed a key different from "Enter". + + In addition, this value is returned (without looking at + gST->ConIn) when PcdConInConnectOnDemand is TRUE. + + @return Error codes from gST->ConIn->ReadKeyStroke(). +**/ +EFI_STATUS +HandleKeyPress ( + VOID + ) +{ + EFI_STATUS Status; + EFI_INPUT_KEY Key; + + if (!PcdGetBool (PcdConInConnectOnDemand)) { + Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); + if (EFI_ERROR (Status)) { + return Status; + } + + if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { + // + // User pressed enter, equivalent to select "continue" + // + return EFI_TIMEOUT; + } + } + + return EFI_SUCCESS; +} + + /** Function show progress bar to wait for user input. @@ -886,7 +926,6 @@ ShowProgress ( CHAR16 *TmpStr; UINT16 TimeoutRemain; EFI_STATUS Status; - EFI_INPUT_KEY Key; EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground; EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background; EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color; @@ -954,21 +993,7 @@ ShowProgress ( // // User pressed some key // - if (!PcdGetBool (PcdConInConnectOnDemand)) { - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (EFI_ERROR (Status)) { - return Status; - } - - if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { - // - // User pressed enter, equivalent to select "continue" - // - return EFI_TIMEOUT; - } - } - - return EFI_SUCCESS; + return HandleKeyPress (); } /**