]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c
Add CTRL+C support for ‘devices’ command.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDriver1CommandsLib / Devices.c
index 7998bde8c61821c873f44fc8275d9b5355c49013..c596baeb2013e9eb3ccce1663cf96619e80ad197 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Main file for devices shell Driver1 function.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012-2014, Hewlett-Packard Development Company, L.P.<BR>\r
+  Copyright (c) 2010 - 2014, 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
@@ -114,6 +115,7 @@ GetDeviceHandleInfo (
 }\r
 \r
 STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+  {L"-sfo", TypeFlag},\r
   {L"-l", TypeValue},\r
   {NULL, TypeMax}\r
   };\r
@@ -146,9 +148,11 @@ ShellCommandRunDevices (
   UINTN               Children;\r
   CHAR16              *Name;\r
   CONST CHAR16        *Lang;\r
+  BOOLEAN             SfoFlag;\r
 \r
   ShellStatus         = SHELL_SUCCESS;\r
   Language            = NULL;\r
+  SfoFlag             = FALSE;\r
 \r
   //\r
   // initialize the shell lib (we must be in non-auto-init...)\r
@@ -203,8 +207,14 @@ ShellCommandRunDevices (
 \r
       //\r
       // Print Header\r
+\r
       //\r
-      ShellPrintHiiEx(-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle);\r
+      if (ShellCommandLineGetFlag (Package, L"-sfo")) {\r
+        ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDriver1HiiHandle, L"devices");\r
+        SfoFlag = TRUE;\r
+      } else {\r
+        ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle);\r
+      }\r
 \r
       //\r
       // loop through each handle\r
@@ -222,16 +232,16 @@ ShellCommandRunDevices (
         Name = NULL;\r
         Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);\r
         if (Name != NULL && (Parents != 0 || Devices != 0 || Children != 0)) {\r
-          ShellPrintHiiEx(\r
+          ShellPrintHiiEx (\r
             -1,\r
             -1,\r
             Language,\r
-            STRING_TOKEN (STR_DEVICES_ITEM_LINE),\r
+            SfoFlag?STRING_TOKEN (STR_DEVICES_ITEM_LINE_SFO):STRING_TOKEN (STR_DEVICES_ITEM_LINE),\r
             gShellDriver1HiiHandle,\r
-            ConvertHandleToHandleIndex(*HandleListWalker),\r
+            ConvertHandleToHandleIndex (*HandleListWalker),\r
             Type,\r
-            Cfg?L'X':L'-',\r
-            Diag?L'X':L'-',\r
+            Cfg?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'),\r
+            Diag?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'),\r
             Parents,\r
             Devices,\r
             Children,\r
@@ -240,6 +250,11 @@ ShellCommandRunDevices (
         if (Name != NULL) {\r
           FreePool(Name);\r
         }\r
+        if (ShellGetExecutionBreakFlag ()) {\r
+          ShellStatus = SHELL_ABORTED;\r
+          break;\r
+        }\r
+        \r
       }\r
 \r
       if (HandleList != NULL) {\r