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
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>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -14,6 +15,8 @@
#include "UefiShellDriver1CommandsLib.h"
#define MAX_LEN_DRIVER_NAME 35
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-sfo", TypeFlag},
{L"-l", TypeValue},
@ -185,15 +188,19 @@ ShellCommandRunDrivers (
UINTN ChildCount;
UINTN DeviceCount;
CHAR16 *Temp2;
CONST CHAR16 *FullDriverName;
CHAR16 *TruncatedDriverName;
CHAR16 *FormatString;
UINT32 DriverVersion;
BOOLEAN DriverConfig;
BOOLEAN DriverDiag;
BOOLEAN SfoFlag;
ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS;
Language = NULL;
FormatString = NULL;
SfoFlag = FALSE;
//
// initialize the shell lib (we must be in non-auto-init...)
@ -234,10 +241,21 @@ ShellCommandRunDrivers (
}
}
if (ShellCommandLineGetFlag(Package, L"-sfo")) {
FormatString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN(STR_DRIVERS_ITEM_LINE_SFO), Language);
if (ShellCommandLineGetFlag (Package, L"-sfo")) {
SfoFlag = TRUE;
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 {
FormatString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN(STR_DRIVERS_ITEM_LINE), Language);
FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language);
//
// print the header row
//
@ -245,7 +263,7 @@ ShellCommandRunDrivers (
-1,
-1,
Language,
STRING_TOKEN(STR_DRIVERS_HEADER_LINES),
STRING_TOKEN (STR_DRIVERS_HEADER_LINES),
gShellDriver1HiiHandle);
}
@ -259,7 +277,13 @@ ShellCommandRunDrivers (
DriverVersion = ReturnDriverVersion(*HandleWalker);
DriverConfig = ReturnDriverConfig(*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(
-1,
@ -272,9 +296,12 @@ ShellCommandRunDrivers (
DriverDiag?L'Y':L'N',
DeviceCount,
ChildCount,
Lang,
SfoFlag?FullDriverName:TruncatedDriverName,
Temp2==NULL?L"":Temp2
);
if (TruncatedDriverName != NULL) {
FreePool (TruncatedDriverName);
}
if (Temp2 != NULL) {
FreePool(Temp2);
}