ShellPkg: Get media status in ifconfig command

v2:
* Update to use NetLibDetectMedia() directly.

This patch is used to get media status in ifconfig command.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18363 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jiaxin Wu
2015-08-31 03:13:33 +00:00
committed by jiaxinwu
parent ead7cb12d5
commit 34297cef1e
2 changed files with 19 additions and 6 deletions

View File

@ -599,9 +599,12 @@ IfConfigShowInterfaceInfo (
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
IFCONFIG_INTERFACE_CB *IfCb;
BOOLEAN MediaPresent;
EFI_IPv4_ADDRESS Gateway;
UINT32 Index;
MediaPresent = TRUE;
if (IsListEmpty (IfList)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
}
@ -619,6 +622,16 @@ IfConfigShowInterfaceInfo (
//
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IF_NAME), gShellNetwork1HiiHandle, IfCb->IfInfo->Name);
//
// Get Media State.
//
NetLibDetectMedia (IfCb->NicHandle, &MediaPresent);
if (!MediaPresent) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media disconnected");
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media present");
}
//
// Print interface config policy.
//