public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Huajing Li <huajing.li@intel.com>
Subject: [PATCH 2/2] ShellPkg/driver: Show "-" in non-SFO mode
Date: Wed,  9 Aug 2017 15:49:35 +0800	[thread overview]
Message-ID: <20170809074935.230172-3-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20170809074935.230172-1-ruiyu.ni@intel.com>

From: Huajing Li <huajing.li@intel.com>

The patch shows "X"/"-" instead of "Y"/"N" in column "CFG"
and "DIAG".
The patch shows "-" instead of "0" in column "#D" and "#C".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
 .../Library/UefiShellDriver1CommandsLib/Drivers.c  | 49 +++++++++++++++-------
 .../UefiShellDriver1CommandsLib.uni                | 12 +++---
 2 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
index f3c1476872..4d876bb108 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
@@ -269,6 +269,8 @@ ShellCommandRunDrivers (
   EFI_HANDLE          *HandleWalker;
   UINTN               ChildCount;
   UINTN               DeviceCount;
+  CHAR16              ChildCountStr[3];
+  CHAR16              DeviceCountStr[3];
   CHAR16              *Temp2;
   CONST CHAR16        *FullDriverName;
   CHAR16              *TruncatedDriverName;
@@ -363,26 +365,45 @@ ShellCommandRunDrivers (
         FullDriverName = GetStringNameFromHandle(*HandleWalker, Language);
         ImageName      = GetImageNameFromHandle (*HandleWalker);
 
+        UnicodeValueToStringS (ChildCountStr,  sizeof (ChildCountStr),  0, ChildCount,  0);
+        UnicodeValueToStringS (DeviceCountStr, sizeof (DeviceCountStr), 0, DeviceCount, 0);
         TruncatedDriverName = NULL;
         if (!SfoFlag && (FullDriverName != NULL)) {
           TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16));
           StrnCpyS (TruncatedDriverName, MAX_LEN_DRIVER_NAME + 1, FullDriverName, MAX_LEN_DRIVER_NAME);
         }
 
-        ShellPrintEx(
-          -1,
-          -1,
-          FormatString,
-          ConvertHandleToHandleIndex(*HandleWalker),
-          DriverVersion,
-          ChildCount > 0?L'B':(DeviceCount > 0?L'D':L'?'),
-          DriverConfig?L'Y':L'N',
-          DriverDiag?L'Y':L'N',
-          DeviceCount,
-          ChildCount,
-          SfoFlag?FullDriverName:TruncatedDriverName,
-          SfoFlag ? (Temp2 == NULL ? L"" : Temp2) : (ImageName == NULL ? L"" : ImageName)
-          );
+        if (!SfoFlag) {
+          ShellPrintEx (
+            -1,
+            -1,
+            FormatString,
+            ConvertHandleToHandleIndex (*HandleWalker),
+            DriverVersion,
+            ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'),
+            DriverConfig ? L'X' : L'-',
+            DriverDiag ? L'X' : L'-',
+            DeviceCount > 0 ? DeviceCountStr : L"-",
+            ChildCount  > 0 ? ChildCountStr : L"-",
+            TruncatedDriverName,
+            ImageName == NULL ? L"" : ImageName
+            );
+        } else {
+          ShellPrintEx (
+            -1,
+            -1,
+            FormatString,
+            ConvertHandleToHandleIndex (*HandleWalker),
+            DriverVersion,
+            ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'),
+            DriverConfig ? L'Y' : L'N',
+            DriverDiag ? L'Y' : L'N',
+            DeviceCount,
+            ChildCount,
+            FullDriverName,
+            Temp2 == NULL ? L"" : Temp2
+            );
+        }
         if (TruncatedDriverName != NULL) {
           FreePool (TruncatedDriverName);
         }
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
index 5ca548d9f6..05101f3782 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni
@@ -90,12 +90,12 @@
 #string STR_DEVICES_ITEM_LINE_SFO #language en-US "DevicesInfo,"%x","%c","%c","%c","%d","%d","%d","%s"\r\n"
 
 #string STR_DRIVERS_HEADER_LINES  #language en-US "%N"
-"             T   D\r\n"
-"             Y C I\r\n"
-"             P F A\r\n"
-"DRV VERSION  E G G #D  #C  DRIVER NAME                         IMAGE NAME\r\n"
-"=== ======== = = = === === =================================== ==========\r\n"
-#string STR_DRIVERS_ITEM_LINE     #language en-US "%H%3x%N %08x %1c %1c %1c %3d %3d %-35s %s\r\n"
+"%H            T   D%N\r\n"
+"%HD           Y C I%N\r\n"
+"%HR           P F A%N\r\n"
+"%HV  VERSION  E G G #D #C DRIVER NAME                         IMAGE NAME%N\r\n"
+"== ======== = = = == == =================================== ==========\r\n"
+#string STR_DRIVERS_ITEM_LINE     #language en-US "%H%2x%N %08x %1c %1c %1c %2s %2s %-35s %s\r\n"
 #string STR_DRIVERS_ITEM_LINE_SFO #language en-US "DriversInfo,"%x","%x","%c","%c","%c","%d","%d","%s","%s"\r\n"
 
 #string STR_DH_OUTPUT_DECODE      #language en-US "%s: %g\r\n"
-- 
2.12.2.windows.2



      parent reply	other threads:[~2017-08-09  7:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170809074935.230172-1-ruiyu.ni@intel.com>
2017-08-09  7:49 ` [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode Ruiyu Ni
2017-08-10  7:53   ` Ard Biesheuvel
2017-08-10 10:14     ` Leif Lindholm
2017-08-09  7:49 ` Ruiyu Ni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170809074935.230172-3-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox