X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellDebug1CommandsLib%2FEditInputBar.c;h=2c8df9d4a6044769764b8aa1138be41ab030d583;hb=ba0014b9f8ae1a593f03e744f26008214c2b06a8;hp=5c43ffcd9d8aabd1cb9af792250bc86ee27912ea;hpb=17e59b3346b7486fabbc57a13ef5b8c98d25a5a5;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c index 5c43ffcd9d..2c8df9d4a6 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c @@ -1,7 +1,7 @@ /** @file Implements inputbar interface functions. - Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -18,26 +18,28 @@ CHAR16 *mPrompt; // Input bar mPrompt string. CHAR16 *mReturnString; // The returned string. UINTN StringSize; // Size of mReturnString space size. +EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mTextInEx; /** Initialize the input bar. + + @param[in] TextInEx Pointer to SimpleTextInEx instance in System Table. **/ VOID -EFIAPI InputBarInit ( - VOID + IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx ) { mPrompt = NULL; mReturnString = NULL; StringSize = 0; + mTextInEx = TextInEx; } /** Cleanup function for input bar. **/ VOID -EFIAPI InputBarCleanup ( VOID ) @@ -59,7 +61,6 @@ InputBarCleanup ( @param[in] LastRow The last printable row. **/ VOID -EFIAPI InputBarPrintInput ( IN UINTN LastColumn, IN UINTN LastRow @@ -121,7 +122,6 @@ typedef union { @retval EFI_SUCCESS The operation was successful. **/ EFI_STATUS -EFIAPI InputBarRefresh ( UINTN LastRow, UINTN LastColumn @@ -129,7 +129,7 @@ InputBarRefresh ( { INPUT_BAR_COLOR_UNION Orig; INPUT_BAR_COLOR_UNION New; - EFI_INPUT_KEY Key; + EFI_KEY_DATA KeyData; UINTN Size; EFI_STATUS Status; BOOLEAN NoDisplay; @@ -178,15 +178,25 @@ InputBarRefresh ( // wait for user input // for (;;) { - gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); + Status = gBS->WaitForEvent (1, &mTextInEx->WaitForKeyEx, &EventIndex); + if (EFI_ERROR (Status) || (EventIndex != 0)) { + continue; + } + Status = mTextInEx->ReadKeyStrokeEx (mTextInEx, &KeyData); if (EFI_ERROR (Status)) { continue; } + if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) && + (KeyData.KeyState.KeyShiftState != EFI_SHIFT_STATE_VALID)) { + // + // Shift key pressed. + // + continue; + } // // pressed ESC // - if (Key.ScanCode == SCAN_ESC) { + if (KeyData.Key.ScanCode == SCAN_ESC) { Size = 0; Status = EFI_NOT_READY; break; @@ -194,9 +204,9 @@ InputBarRefresh ( // // return pressed // - if (Key.UnicodeChar == CHAR_LINEFEED || Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { + if (KeyData.Key.UnicodeChar == CHAR_LINEFEED || KeyData.Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { break; - } else if (Key.UnicodeChar == CHAR_BACKSPACE) { + } else if (KeyData.Key.UnicodeChar == CHAR_BACKSPACE) { // // backspace // @@ -209,11 +219,11 @@ InputBarRefresh ( } } - } else if (Key.UnicodeChar <= 127 && Key.UnicodeChar >= 32) { + } else if (KeyData.Key.UnicodeChar <= 127 && KeyData.Key.UnicodeChar >= 32) { // // VALID ASCII char pressed // - mReturnString[Size] = Key.UnicodeChar; + mReturnString[Size] = KeyData.Key.UnicodeChar; // // should be less than specified length @@ -241,7 +251,7 @@ InputBarRefresh ( } mReturnString[Size] = CHAR_NULL; - + // // restore screen attributes @@ -261,7 +271,6 @@ InputBarRefresh ( @retval EFI_OUT_OF_RESOURCES A memory allocation failed. **/ EFI_STATUS -EFIAPI InputBarSetPrompt ( IN CONST CHAR16 *Str ) @@ -288,7 +297,6 @@ InputBarSetPrompt ( @retval EFI_OUT_OF_RESOURCES A memory allocation failed. **/ EFI_STATUS -EFIAPI InputBarSetStringSize ( UINTN Size ) @@ -314,7 +322,6 @@ InputBarSetStringSize ( @return The string that was input. **/ CONST CHAR16* -EFIAPI InputBarGetString ( VOID )