fix for word wrapping.

fix for SimpleTextInEx callbacks.
remove an ASSERT.
fix for -noconsolein parameter.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11544 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2011-04-15 18:20:40 +00:00
parent f6ea51e5ac
commit a49f6a2f7e
7 changed files with 48 additions and 26 deletions

View File

@ -729,7 +729,7 @@ ConsoleLoggerPrintWithPageBreak(
//
// check if that is the last column
//
if ((INTN)ConsoleInfo->ColsPerScreen == ConsoleInfo->OurConOut.Mode->CursorColumn - 1) {
if ((INTN)ConsoleInfo->ColsPerScreen == ConsoleInfo->OurConOut.Mode->CursorColumn + 1) {
//
// output a line similar to the linefeed character.
//
@ -753,7 +753,7 @@ ConsoleLoggerPrintWithPageBreak(
//
// Update LineStart Variable
//
LineStart = Walker;
LineStart = Walker + 1;
//
// increment row count and zero the column
@ -810,12 +810,22 @@ ConsoleLoggerOutputString (
IN CHAR16 *WString
)
{
EFI_INPUT_KEY Key;
UINTN EventIndex;
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
return (EFI_UNSUPPORTED);
}
ASSERT(ShellInfoObject.ConsoleInfo == ConsoleInfo);
if (ShellInfoObject.HaltOutput) {
//
// just get some key
//
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
ShellInfoObject.HaltOutput = FALSE;
}
if (!ShellInfoObject.ConsoleInfo->Enabled) {
return (EFI_DEVICE_ERROR);
} else if (ShellInfoObject.PageBreakEnabled) {

View File

@ -249,7 +249,7 @@ FileInterfaceStdErrRead(
File style interface for NUL file (Read).
@param[in] This Ignored.
@param[in,out] BufferSize Ignored.
@param[in,out] BufferSize Poiner to 0 upon return.
@param[out] Buffer Ignored.
@retval EFI_SUCCESS Always.
@ -262,6 +262,7 @@ FileInterfaceNulRead(
OUT VOID *Buffer
)
{
*BufferSize = 0;
return (EFI_SUCCESS);
}

View File

@ -55,7 +55,8 @@ SHELL_INFO ShellInfoObject = {
NULL,
NULL,
NULL,
NULL
NULL,
FALSE
};
STATIC CONST CHAR16 mScriptExtension[] = L".NSH";
@ -155,17 +156,11 @@ UefiMain (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
CHAR16 *TempString;
UINTN Size;
// EFI_INPUT_KEY Key;
// gST->ConOut->OutputString(gST->ConOut, L"ReadKeyStroke Calling\r\n");
//
// Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
//
// gST->ConOut->OutputString(gST->ConOut, L"ReadKeyStroke Done\r\n");
// gBS->Stall (1000000);
EFI_STATUS Status;
CHAR16 *TempString;
UINTN Size;
EFI_HANDLE ConInHandle;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn;
if (PcdGet8(PcdShellSupportLevel) > 3) {
return (EFI_UNSUPPORTED);
@ -361,6 +356,18 @@ UefiMain (
Status = InternalEfiShellStartCtrlSMonitor();
}
if (!EFI_ERROR(Status) && ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
//
// close off the gST->ConIn
//
OldConIn = gST->ConIn;
ConInHandle = gST->ConsoleInHandle;
gST->ConIn = CreateSimpleTextInOnFile((SHELL_FILE_HANDLE)&FileInterfaceNulFile, &gST->ConsoleInHandle);
} else {
OldConIn = NULL;
ConInHandle = NULL;
}
if (!EFI_ERROR(Status) && PcdGet8(PcdShellSupportLevel) >= 1) {
//
// process the startup script or launch the called app.
@ -399,6 +406,11 @@ UefiMain (
Status = DoShellPrompt();
} while (!ShellCommandGetExit());
}
if (OldConIn != NULL && ConInHandle != NULL) {
CloseSimpleTextInOnFile (gST->ConIn);
gST->ConIn = OldConIn;
gST->ConsoleInHandle = ConInHandle;
}
}
}
@ -548,8 +560,6 @@ IsScriptOnlyCommand(
return (FALSE);
}
/**
This function will populate the 2 device path protocol parameters based on the
global gImageHandle. The DevPath will point to the device path for the handle that has
@ -598,6 +608,11 @@ GetDevicePathsForImageAndFile (
if (!EFI_ERROR (Status)) {
*DevPath = DuplicateDevicePath (ImageDevicePath);
*FilePath = DuplicateDevicePath (LoadedImage->FilePath);
gBS->CloseProtocol(
LoadedImage->DeviceHandle,
&gEfiDevicePathProtocolGuid,
gImageHandle,
NULL);
}
gBS->CloseProtocol(
gImageHandle,
@ -620,6 +635,7 @@ STATIC CONST SHELL_PARAM_ITEM mShellParamList[] = {
{L"-delay", TypeValue},
{NULL, TypeMax}
};
/**
Process all Uefi Shell 2.0 command line options.

View File

@ -50,6 +50,7 @@
#include "ShellEnvVar.h"
#include "ConsoleLogger.h"
#include "ShellManParser.h"
#include "ConsoleWrappers.h"
typedef struct {
LIST_ENTRY Link; ///< Standard linked list handler.
@ -113,6 +114,7 @@ typedef struct {
EFI_HANDLE CtrlSNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
EFI_HANDLE CtrlSNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
EFI_HANDLE CtrlSNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
BOOLEAN HaltOutput; ///< TRUE to start a CTRL-S halt.
} SHELL_INFO;
extern SHELL_INFO ShellInfoObject;

View File

@ -3326,8 +3326,6 @@ NotificationFunction(
IN EFI_KEY_DATA *KeyData
)
{
EFI_INPUT_KEY Key;
UINTN EventIndex;
// ShellPrintEx(-1,-1,L" <Notify> ");
if ((KeyData->Key.UnicodeChar == L'c' || KeyData->Key.UnicodeChar == 3) &&
(KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))
@ -3339,11 +3337,7 @@ NotificationFunction(
} else if ((KeyData->Key.UnicodeChar == L's') &&
(KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))
){
//
// just get some key
//
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
ShellInfoObject.HaltOutput = TRUE;
}
return (EFI_SUCCESS);
}

View File

@ -82,9 +82,8 @@ ShellCommandRunPause (
} else {
Status = ShellPromptForResponse(ShellPromptResponseTypeQuitContinue, NULL, (VOID**)&Resp);
}
ASSERT_EFI_ERROR(Status);
if (Resp == NULL || *Resp == ShellPromptResponseQuit) {
if (EFI_ERROR(Status) || Resp == NULL || *Resp == ShellPromptResponseQuit) {
ShellCommandRegisterExit(TRUE);
ShellStatus = SHELL_ABORTED;
}