ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.

Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting
state handling, and it is forward compatible. So apply this Api in ShellPkg.

V2:
   *Define time period in a macro instead of hard code.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Signed-off-by: fanwang2 <fan.wang@intel.com>
This commit is contained in:
fanwang2 2017-12-18 09:21:22 +08:00 committed by Fu Siyuan
parent 152f2d5e45
commit 0f1e07ee63
3 changed files with 12 additions and 12 deletions

View File

@ -550,11 +550,11 @@ IfConfigShowInterfaceInfo (
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
IFCONFIG_INTERFACE_CB *IfCb;
BOOLEAN MediaPresent;
EFI_STATUS MediaStatus;
EFI_IPv4_ADDRESS Gateway;
UINT32 Index;
MediaPresent = TRUE;
MediaStatus = EFI_SUCCESS;
if (IsListEmpty (IfList)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
@ -576,8 +576,8 @@ IfConfigShowInterfaceInfo (
//
// Get Media State.
//
if (EFI_SUCCESS == NetLibDetectMedia (IfCb->NicHandle, &MediaPresent)) {
if (!MediaPresent) {
if (EFI_SUCCESS == NetLibDetectMediaWaitTimeout (IfCb->NicHandle, 0, &MediaStatus)) {
if (MediaStatus != EFI_SUCCESS) {
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");

View File

@ -966,7 +966,7 @@ PingCreateIpInstance (
UINTN HandleNum;
EFI_HANDLE *HandleBuffer;
BOOLEAN UnspecifiedSrc;
BOOLEAN MediaPresent;
EFI_STATUS MediaStatus;
EFI_SERVICE_BINDING_PROTOCOL *EfiSb;
VOID *IpXCfg;
EFI_IP6_CONFIG_DATA Ip6Config;
@ -978,7 +978,7 @@ PingCreateIpInstance (
HandleBuffer = NULL;
UnspecifiedSrc = FALSE;
MediaPresent = TRUE;
MediaStatus = EFI_SUCCESS;
EfiSb = NULL;
IpXInterfaceInfo = NULL;
IfInfoSize = 0;
@ -1035,8 +1035,8 @@ PingCreateIpInstance (
//
// Check media.
//
NetLibDetectMedia (HandleBuffer[HandleIndex], &MediaPresent);
if (!MediaPresent) {
NetLibDetectMediaWaitTimeout (HandleBuffer[HandleIndex], 0, &MediaStatus);
if (MediaStatus != EFI_SUCCESS) {
//
// Skip this one.
//

View File

@ -755,7 +755,7 @@ Ping6CreateIpInstance (
UINTN HandleNum;
EFI_HANDLE *HandleBuffer;
BOOLEAN UnspecifiedSrc;
BOOLEAN MediaPresent;
EFI_STATUS MediaStatus;
EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
EFI_IP6_CONFIG_DATA Ip6Config;
@ -766,7 +766,7 @@ Ping6CreateIpInstance (
HandleBuffer = NULL;
UnspecifiedSrc = FALSE;
MediaPresent = TRUE;
MediaStatus = EFI_SUCCESS
Ip6Sb = NULL;
IfInfo = NULL;
IfInfoSize = 0;
@ -814,8 +814,8 @@ Ping6CreateIpInstance (
//
// Check media.
//
NetLibDetectMedia (HandleBuffer[HandleIndex], &MediaPresent);
if (!MediaPresent) {
NetLibDetectMediaWaitTimeout (HandleBuffer[HandleIndex], 0, &MediaStatus);
if (MediaStatus != EFI_SUCCESS) {
//
// Skip this one.
//