From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::444; helo=mail-pf1-x444.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9C41F210EE4E7 for ; Wed, 22 Aug 2018 23:14:40 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id j26-v6so2151619pfi.10 for ; Wed, 22 Aug 2018 23:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=NyLj0UK9KwEM0Fmiv13Qj7YFn44upUEEjSF1Bn8IEtY=; b=GOfbTWz81b9IIUm8X0+TZcsuIK8conMfuyV/PZ/3uOt0PHPmVTi6rOwTUhkvxIpQJz 0hVYisloHgG5VGWlwI6Cr6Fp9OFHZet9JDkbUUIEC7sDccGbGH5TQltSFIaFslfK1ZfT ej1q5hN90DDqD4YH9+ICtJPoMhRC/9NIsVIBs= 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; bh=NyLj0UK9KwEM0Fmiv13Qj7YFn44upUEEjSF1Bn8IEtY=; b=SsbJo4XFWXipAF853LVBDeIq37omZ9utv8SF5tDkhDhZmmbkAyilFFSAeGo9cKu+vm aNDLxAiUoZD6MPaOtC4OKs+NAsDrjLYZN/xvYzJ/eQDHQNqUX0hLrmPbsjjQ7Fkpra4b K7gn7mkZwNdeckgm5t7GkxVHfWXRKf+twCBQgnv+iAT7YlpNGwftjDHBOrLeWU64TcXV jL8W5EitWXffh6VFtyFo1jiPGtj9fmFzsGHzSGSZYq80sqNN3xwk7nU/sGp2CkY37V3O 4aTX5cxHKSjnS3x5kxorMno/8G+QOyIlhqslEFB3dKcTrPyzFLGXIG4khQJCFCF/pobR 2qXA== X-Gm-Message-State: APzg51Bkl9XW2647qmWRM0i8zMJsSRdOX6syD37V4M4chHYzJqOmEVj7 vBYk2yL8Tj/IDXw2w/OBAbVGbgmb/3CcUg== X-Google-Smtp-Source: ANB0VdZqEHGm0UVljVPDPjn5DVFYaCGkjgV5RFWajLT0vRvXDuySu+ve20+PCS5dgnySc3nIIv57og== X-Received: by 2002:a63:4c46:: with SMTP id m6-v6mr4408204pgl.156.1535004879409; Wed, 22 Aug 2018 23:14:39 -0700 (PDT) Received: from localhost.localdomain ([64.64.108.80]) by smtp.gmail.com with ESMTPSA id x2-v6sm6245436pfi.166.2018.08.22.23.14.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Aug 2018 23:14:38 -0700 (PDT) From: Haojian Zhuang To: edk2-devel@lists.01.org Date: Thu, 23 Aug 2018 14:14:33 +0800 Message-Id: <1535004873-24208-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [PATCH v1 1/1] EmbeddedPkg/AndroidFastbootApp: only use ENTER or SPACE to exit X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2018 06:14:40 -0000 Since hotkey 'f' is used to start AndroidFastbootApp. If user press 'f' key too long, it may be recognized pressing 'f' key multiple times. Then AndroidFastbootApp exists since it delcares any key press could make it exit. So only use ENTER or SPACE key to exit AndroidFastbootApp. Cc: Leif Lindholm Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index c5e8a7e34af2..c1ed94f92b6f 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -426,6 +426,7 @@ FastbootAppEntryPoint ( EFI_EVENT WaitEventArray[2]; UINTN EventIndex; EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn; + EFI_INPUT_KEY Key; mDataBuffer = NULL; @@ -508,12 +509,21 @@ FastbootAppEntryPoint ( // Talk to the user mTextOut->OutputString (mTextOut, - L"Android Fastboot mode - version " ANDROID_FASTBOOT_VERSION ". Press any key to quit.\r\n"); + L"Android Fastboot mode - version " ANDROID_FASTBOOT_VERSION ". Press RETURN or SPACE key to quit.\r\n"); // Quit when the user presses any key, or mFinishedEvent is signalled WaitEventArray[0] = mFinishedEvent; WaitEventArray[1] = TextIn->WaitForKey; - gBS->WaitForEvent (2, WaitEventArray, &EventIndex); + while (1) { + gBS->WaitForEvent (2, WaitEventArray, &EventIndex); + Status = TextIn->ReadKeyStroke (gST->ConIn, &Key); + if (Key.ScanCode == SCAN_NULL) { + if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN) || + (Key.UnicodeChar == L' ')) { + break; + } + } + } mTransport->Stop (); if (EFI_ERROR (Status)) { -- 2.7.4