diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2018-08-23 14:14:33 +0800 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-08-24 15:44:18 +0100 |
commit | 6861765935d5b69803321ba6e43240845c7ab0e5 (patch) | |
tree | 8b757aaf05a7c9d0a53858e5d8c18e2d9253b085 | |
parent | 16973234fc60a95daf7be32ee89123914fdab3f0 (diff) | |
download | edk2-6861765935d5b69803321ba6e43240845c7ab0e5.tar.gz edk2-6861765935d5b69803321ba6e43240845c7ab0e5.tar.bz2 edk2-6861765935d5b69803321ba6e43240845c7ab0e5.zip |
EmbeddedPkg/AndroidFastbootApp: only use ENTER or SPACE to exit
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.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r-- | EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index c5e8a7e34a..c1ed94f92b 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)) {
|