[edk2] [PATCH 01/14] ShellPkg/dh: display all the protocol names in a single line

Ruiyu Ni posted 14 patches 7 years, 3 months ago
[edk2] [PATCH 01/14] ShellPkg/dh: display all the protocol names in a single line
Posted by Ruiyu Ni 7 years, 3 months ago
From: Huajing Li <huajing.li@intel.com>

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Huajing Li <huajing.li@intel.com>
---
 ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c  | 36 ++++++++++++++--------
 .../UefiShellDriver1CommandsLib.uni                |  1 +
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
index 170a868e07..3694e501b6 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
@@ -319,7 +319,7 @@ GetProtocolInfoString(
           if (!Verbose) {
             StrnCatGrow(&RetVal, &Size, L"(", 0);
             StrnCatGrow(&RetVal, &Size, Temp, 0);
-            StrnCatGrow(&RetVal, &Size, L")\r\n", 0);
+            StrnCatGrow(&RetVal, &Size, L")", 0);
           } else {
             StrnCatGrow(&RetVal, &Size, Separator, 0);
             StrnCatGrow(&RetVal, &Size, Temp, 0);
@@ -802,17 +802,29 @@ DoDhByHandle(
         ProtocolInfoString==NULL?L"":ProtocolInfoString
       );
     } else {
-      ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L"\r\n", Verbose, TRUE);
-      ShellPrintHiiEx(
-        -1,
-        -1,
-        NULL,
-        STRING_TOKEN (STR_DH_OUTPUT_SINGLE),
-        gShellDriver1HiiHandle,
-        ConvertHandleToHandleIndex(TheHandle),
-        TheHandle,
-        ProtocolInfoString==NULL?L"":ProtocolInfoString
-      );
+      ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, Verbose ? L"\r\n" : L" ", Verbose, TRUE);
+      if (Verbose) {
+        ShellPrintHiiEx(
+          -1,
+          -1,
+          NULL,
+          STRING_TOKEN (STR_DH_OUTPUT_SINGLE),
+          gShellDriver1HiiHandle,
+          ConvertHandleToHandleIndex(TheHandle),
+          TheHandle,
+          ProtocolInfoString==NULL?L"":ProtocolInfoString
+        );
+      } else {
+        ShellPrintHiiEx(
+          -1,
+          -1,
+          NULL,
+          STRING_TOKEN (STR_DH_OUTPUT_SINGLE_D),
+          gShellDriver1HiiHandle,
+          ConvertHandleToHandleIndex(TheHandle),
+          ProtocolInfoString==NULL?L"":ProtocolInfoString
+        );
+      }
     }
 
     if (DriverInfo) {
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
index 05101f3782..07e8657113 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
@@ -106,6 +106,7 @@
 #string STR_DH_OUTPUT_ALL_HEADER  #language en-US "Handle dump\r\n"
 #string STR_DH_OUTPUT_GUID_HEADER #language en-US "Handle dump by protocol '%g'\r\n"
 #string STR_DH_OUTPUT_NAME_HEADER #language en-US "Handle dump by protocol '%s'\r\n"
+#string STR_DH_OUTPUT_SINGLE_D    #language en-US "%H%02x%N: %s\r\n"
 #string STR_DH_OUTPUT_SINGLE      #language en-US "%H%02x%N: %x\r\n%s"
 #string STR_DH_OUTPUT_SFO         #language en-US "%s, %s, %s, %H%02x%N, %s, %s\r\n"
 #string STR_DH_OUTPUT_DRIVER1     #language en-US "   Controller Name    : %B%s%N\r\n"
-- 
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel