]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ConsoleLogger.c
Enhance Shell 2.0 to not depend on keyboard driver implementation to fix the "CTRL...
[mirror_edk2.git] / ShellPkg / Application / Shell / ConsoleLogger.c
index c3729f16c9471d1cd45a0deffdb37684ffa72f3c..6f7ed95a611ebec13cf6417e0919ada3cc0ee652 100644 (file)
@@ -2,7 +2,7 @@
   Provides interface to shell console logger.\r
 \r
   Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -819,22 +819,41 @@ ConsoleLoggerOutputString (
   IN  CHAR16                          *WString\r
   )\r
 {\r
-  EFI_INPUT_KEY               Key;\r
-  UINTN                       EventIndex;\r
-  CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;\r
+  EFI_STATUS                        Status;\r
+  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx;\r
+  EFI_KEY_DATA                      KeyData;\r
+  UINTN                             EventIndex;\r
+  CONSOLE_LOGGER_PRIVATE_DATA       *ConsoleInfo;\r
+\r
   ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);\r
   if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {\r
     return (EFI_UNSUPPORTED);\r
   }\r
   ASSERT(ShellInfoObject.ConsoleInfo == ConsoleInfo);\r
-  if (ShellInfoObject.HaltOutput) {\r
-    //\r
-    // just get some key\r
-    //\r
-    gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
-    gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-    ShellInfoObject.HaltOutput = FALSE;\r
+\r
+  Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **) &TxtInEx);\r
+  if (!EFI_ERROR (Status)) {\r
+    while (ShellInfoObject.HaltOutput) {\r
+\r
+      ShellInfoObject.HaltOutput = FALSE;\r
+      //\r
+      // just get some key\r
+      //\r
+      Status = gBS->WaitForEvent (1, &TxtInEx->WaitForKeyEx, &EventIndex);\r
+      ASSERT_EFI_ERROR (Status);\r
+      Status = TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData);\r
+      ASSERT_EFI_ERROR (Status);\r
+\r
+      if ((KeyData.Key.UnicodeChar == L's') && (KeyData.Key.ScanCode == SCAN_NULL) &&\r
+          ((KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED)) ||\r
+           (KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED))\r
+          )\r
+         ) {\r
+        ShellInfoObject.HaltOutput = TRUE;\r
+      }\r
+    }\r
   }\r
+\r
   if (!ShellInfoObject.ConsoleInfo->Enabled) {\r
     return (EFI_DEVICE_ERROR);\r
   } else if (ShellInfoObject.PageBreakEnabled) {\r