diff options
Diffstat (limited to 'ShellPkg/Application/Shell')
-rw-r--r-- | ShellPkg/Application/Shell/ConsoleLogger.c | 14 | ||||
-rw-r--r-- | ShellPkg/Application/Shell/FileHandleWrappers.c | 3 | ||||
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 44 | ||||
-rw-r--r-- | ShellPkg/Application/Shell/Shell.h | 2 | ||||
-rw-r--r-- | ShellPkg/Application/Shell/ShellProtocol.c | 8 |
5 files changed, 47 insertions, 24 deletions
diff --git a/ShellPkg/Application/Shell/ConsoleLogger.c b/ShellPkg/Application/Shell/ConsoleLogger.c index 58518cabe9..01104e6735 100644 --- a/ShellPkg/Application/Shell/ConsoleLogger.c +++ b/ShellPkg/Application/Shell/ConsoleLogger.c @@ -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) {
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index b2163bebb9..3cadc41e0b 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -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);
}
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index a56967189b..ae4c0606e3 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -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.
diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h index 3699fb233d..51ec4f3a4b 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -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;
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 2d587ea03b..8b2e89041b 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -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);
}
|