ShellPkg: Fixes and updates for the 'drivers' command

- Update 'drivers -sfo' format to match UEFI Shell 2.1 spec
- Update help output for easier viewing
- Update 'drivers' output format for better alignment
             T   D
             Y C I
             P F A
DRV VERSION  E G G #D  #C  DRIVER NAME                         IMAGE PATH
=== ======== = = = === === =================================== ==========

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15870 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Chris Phillips 2014-08-21 20:16:32 +00:00 committed by jcarsey
parent 53715dcd50
commit a29117bf9e
2 changed files with 41 additions and 14 deletions

View File

@ -1,6 +1,7 @@
/** @file /** @file
Main file for Drivers shell Driver1 function. Main file for Drivers shell Driver1 function.
(C) Copyright 2012-2014, Hewlett-Packard Development Company, L.P.
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -14,6 +15,8 @@
#include "UefiShellDriver1CommandsLib.h" #include "UefiShellDriver1CommandsLib.h"
#define MAX_LEN_DRIVER_NAME 35
STATIC CONST SHELL_PARAM_ITEM ParamList[] = { STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-sfo", TypeFlag}, {L"-sfo", TypeFlag},
{L"-l", TypeValue}, {L"-l", TypeValue},
@ -185,15 +188,19 @@ ShellCommandRunDrivers (
UINTN ChildCount; UINTN ChildCount;
UINTN DeviceCount; UINTN DeviceCount;
CHAR16 *Temp2; CHAR16 *Temp2;
CONST CHAR16 *FullDriverName;
CHAR16 *TruncatedDriverName;
CHAR16 *FormatString; CHAR16 *FormatString;
UINT32 DriverVersion; UINT32 DriverVersion;
BOOLEAN DriverConfig; BOOLEAN DriverConfig;
BOOLEAN DriverDiag; BOOLEAN DriverDiag;
BOOLEAN SfoFlag;
ShellStatus = SHELL_SUCCESS; ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Language = NULL; Language = NULL;
FormatString = NULL; FormatString = NULL;
SfoFlag = FALSE;
// //
// initialize the shell lib (we must be in non-auto-init...) // initialize the shell lib (we must be in non-auto-init...)
@ -235,7 +242,18 @@ ShellCommandRunDrivers (
} }
if (ShellCommandLineGetFlag (Package, L"-sfo")) { if (ShellCommandLineGetFlag (Package, L"-sfo")) {
SfoFlag = TRUE;
FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language); FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language);
//
// print the SFO header
//
ShellPrintHiiEx (
-1,
-1,
Language,
STRING_TOKEN (STR_GEN_SFO_HEADER),
gShellDriver1HiiHandle,
L"drivers");
} else { } else {
FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language); FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language);
// //
@ -259,7 +277,13 @@ ShellCommandRunDrivers (
DriverVersion = ReturnDriverVersion(*HandleWalker); DriverVersion = ReturnDriverVersion(*HandleWalker);
DriverConfig = ReturnDriverConfig(*HandleWalker); DriverConfig = ReturnDriverConfig(*HandleWalker);
DriverDiag = ReturnDriverDiag (*HandleWalker); DriverDiag = ReturnDriverDiag (*HandleWalker);
Lang = GetStringNameFromHandle(*HandleWalker, Language); FullDriverName = GetStringNameFromHandle(*HandleWalker, Language);
TruncatedDriverName = NULL;
if (!SfoFlag && (FullDriverName != NULL)) {
TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16));
StrnCpy (TruncatedDriverName, FullDriverName, MAX_LEN_DRIVER_NAME);
}
ShellPrintEx( ShellPrintEx(
-1, -1,
@ -272,9 +296,12 @@ ShellCommandRunDrivers (
DriverDiag?L'Y':L'N', DriverDiag?L'Y':L'N',
DeviceCount, DeviceCount,
ChildCount, ChildCount,
Lang, SfoFlag?FullDriverName:TruncatedDriverName,
Temp2==NULL?L"":Temp2 Temp2==NULL?L"":Temp2
); );
if (TruncatedDriverName != NULL) {
FreePool (TruncatedDriverName);
}
if (Temp2 != NULL) { if (Temp2 != NULL) {
FreePool(Temp2); FreePool(Temp2);
} }