Revision: 18364
          http://sourceforge.net/p/edk2/code/18364
Author:   hwu1225
Date:     2015-08-31 06:03:10 +0000 (Mon, 31 Aug 2015)
Log Message:
-----------
ShellPkg: Get media status in ifconfig command

v2:
* Update to use NetLibDetectMedia() directly.

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

(Sync patch r18363 from main trunk.)

Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18363

Modified Paths:
--------------
    branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
    
branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni

Modified: 
branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
===================================================================
--- branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c   
2015-08-31 03:13:33 UTC (rev 18363)
+++ branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c   
2015-08-31 06:03:10 UTC (rev 18364)
@@ -596,11 +596,14 @@
   IN LIST_ENTRY    *IfList
   )
 {
-  LIST_ENTRY                *Entry;
-  LIST_ENTRY                *Next;
-  IFCONFIG_INTERFACE_CB     *IfCb;
-  EFI_IPv4_ADDRESS          Gateway;
-  UINT32                    Index;
+  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);
@@ -617,9 +620,19 @@
     //
     // Print interface name.
     //
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IF_NAME), 
gShellNetwork1HiiHandle, IfCb->IfInfo->Name);
+    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.
     //
     if (IfCb->Policy == Ip4Config2PolicyDhcp) {

Modified: 
branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni
===================================================================
--- 
branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni
     2015-08-31 03:13:33 UTC (rev 18363)
+++ 
branches/UDK2015/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni
     2015-08-31 06:03:10 UTC (rev 18364)
@@ -152,6 +152,8 @@
  +  

------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to