StdLib: Some deployed versions of the Simple Text Input Protocol randomly return either NUL characters or Scan Codes when just typing normal text. These changes filter out NUL characters and make Scan Code and error handling more robust.

StdLibPrivateInternalFiles/Include/Device/Console.h: Change UnGetKey, in the ConInstance structure, from an EFI_INPUT_KEY structure to a CHAR16 variable.

Include/sys/termios.h: Add CHAR_SUB and CHAR_ESC for translation of '^Z' and the Escape Scan Code into the EOF and ESC characters, respectively.

LibC/Uefi/Devices/Console/daConsole.c:  Add da_ConRawRead() function to simplify the read logic. Discard NUL characters from the input stream.  In Blocking mode, retry until a non-NUL character is received.  In NonBlocking mode, a NUL causes an EAGAIN error to be returned.  Translate the Escape Scan Code into an ESC character.  If Scan Codes are ignored, retry if in Blocking mode else return an EAGAIN error.  UnGetKey becomes a single wide character instead of a structure.
    Change da_Poll() to use da_ConRawRead().

LibC/Uefi/InteractiveIO/IIOutilities.c:  BUG fix.  Return the processed input character instead of the raw character.  Allows EOF propagation.

LibC/Uefi/InteractiveIO/CanonRead.c:  Enable EOF propagation.

LibC/Uefi/InteractiveIO/IIOechoCtrl.h:  Use symbols defined in termios.h instead of hard-coded constant numbers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by:  Daryl McDaniel  <daryl.mcdaniel@intel.com>
Reviewed-by:  Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by:  Erik Bjorge <erik.c.bjorge@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16254 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Daryl McDaniel
2014-10-28 19:20:48 +00:00
committed by darylm503
parent 8dd618d211
commit 24903bc48a
6 changed files with 151 additions and 88 deletions

View File

@@ -3,7 +3,7 @@
The functions assume that isatty() is TRUE at the time they are called.
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
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
@@ -87,6 +87,10 @@ IIO_CanonRead (
// Input and process characters until BufferSize is exhausted.
do {
InChar = IIO_GetInChar(filp, FirstRead);
if (InChar == WEOF) {
NumRead = 0;
break;
}
FirstRead = FALSE;
Activate = TRUE;
if(InChar == CHAR_CARRIAGE_RETURN) {
@@ -128,6 +132,8 @@ IIO_CanonRead (
}
else if(CCEQ(Termio->c_cc[VEOF], InChar)) {
InChar = WEOF;
NumRead = 0;
EchoIsOK = FALSE; // Buffer, but don't echo this character
}
else if(CCEQ(Termio->c_cc[VEOL], InChar)) {
EchoIsOK = FALSE; // Buffer, but don't echo this character