diff options
author | Chris Phillips <chrisp@hp.com> | 2014-08-21 20:16:32 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-21 20:16:32 +0000 |
commit | a29117bf9e278763dfa6113492eb443be4ab67bc (patch) | |
tree | b6e8e698b5f63b03050c482bbd23bdf6c55de3c9 | |
parent | 53715dcd5065883f83152d17b128aa1be120c4fb (diff) | |
download | edk2-a29117bf9e278763dfa6113492eb443be4ab67bc.zip edk2-a29117bf9e278763dfa6113492eb443be4ab67bc.tar.gz edk2-a29117bf9e278763dfa6113492eb443be4ab67bc.tar.bz2 |
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
-rw-r--r-- | ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c | 55 | ||||
-rw-r--r-- | ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni | bin | 70038 -> 67508 bytes |
2 files changed, 41 insertions, 14 deletions
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c index fe314f7..7dff549 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c @@ -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,21 +263,27 @@ ShellCommandRunDrivers ( -1,
-1,
Language,
- STRING_TOKEN(STR_DRIVERS_HEADER_LINES),
+ STRING_TOKEN (STR_DRIVERS_HEADER_LINES),
gShellDriver1HiiHandle);
}
HandleList = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid);
for (HandleWalker = HandleList ; HandleWalker != NULL && *HandleWalker != NULL ; HandleWalker++){
- ChildCount = 0;
- DeviceCount = 0;
- Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL);
- Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL);
- Temp2 = GetDevicePathTextForHandle(*HandleWalker);
- DriverVersion = ReturnDriverVersion(*HandleWalker);
- DriverConfig = ReturnDriverConfig(*HandleWalker);
- DriverDiag = ReturnDriverDiag (*HandleWalker);
- Lang = GetStringNameFromHandle(*HandleWalker, Language);
+ ChildCount = 0;
+ DeviceCount = 0;
+ Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL);
+ Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL);
+ Temp2 = GetDevicePathTextForHandle(*HandleWalker);
+ DriverVersion = ReturnDriverVersion(*HandleWalker);
+ DriverConfig = ReturnDriverConfig(*HandleWalker);
+ DriverDiag = ReturnDriverDiag (*HandleWalker);
+ 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);
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni Binary files differindex a7c787e..5655a4b 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni |