Enhance sys_info and postcode for multi-host

This patch enhances multi-host platform support in the OCP debug card
display (sys_info and postcode pages) and OEM command modules.
It replaces hard-coded D-Bus paths and single-interface networkqueries
with dynamic lookups based on the current host selector position.
 -Sys_Info page now retrieves the correct FRU path.
 -POSTCODE page dynamically calls Boot.PostCode<N> service/object for
  each host slot.
 -Network information Network information now supports fetching from
  eth1 when eth0 is unavailable, preventing missing data or crashes.

Motivation:
Original implementation used hardcoded D-Bus paths such as PostCode0
and only checked eth0 for network-related data. On multi-host platforms,
each host has a separate PostCode service, and FRU/FW data may differ
or be present in alternate paths. Moreover, some systems expose IP/MAC
data on eth1, causing failures when only eth0 is queried. These issue
led to incomplete data being shown or crashes in the sys_info display.

Design:
- Introduced logic to dynamically determine the current host position
 and fetch the corresponding PostCode service (PostCode0 ~ PostCode7).
- Enhance `getNetworkData` to check both eth0 and eth1 for IP and MAC
 addresses, and avoid crashes if a value is not found.
- Updated FRU retrieval to support multiple motherboard paths and
 fallback paths, using filtered D-Bus object mapping
 via interface matching and predicate.
- Ensured all std::string results are checked before accessing to
 prevent null dereferencing and crashes.

Change-Id: I0c88eb58c3b416437a02994c4c202d5c2269d32a
Signed-off-by: Liora Guo <liora.guo.wiwynn@gmail.com>
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index 70b69a0..57c3339 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -650,19 +650,25 @@
         }
 
         getMaxHostPosition(maxPosition);
+        std::string data;
         if (hostPosition == BMC_POSITION || hostInstances == "0")
         {
-            std::string data = "FRU:" + getMotherBoardFruName();
-            frame_info.append(data);
+            data = "FRU:" + getMotherBoardFruName();
         }
         else if (hostPosition != BMC_POSITION && hostPosition <= maxPosition)
         {
-            std::string data = "FRU:slot" + std::to_string(hostPosition);
-            frame_info.append(data);
+            if (getMotherBoardFruName() != "")
+            {
+                data = "FRU:" + getMotherBoardFruName();
+            }
+            else
+            {
+                data = "FRU:slot" + std::to_string(hostPosition);
+            }
         }
+        frame_info.append(data);
 
         // FRU
-        std::string data;
         frame_info.append("SN:");
         if (getFruData(data, serialName) != 0)
         {
@@ -783,6 +789,8 @@
 {
     // up to 70 codes can be displayed on 10 pages
     static constexpr size_t maxPostcodes = 70;
+    bool platform = isMultiHostPlatform();
+    size_t hostPosition = 0;
 
     if (page == 1)
     {
@@ -791,18 +799,24 @@
         snprintf(frame_postcode.title, 32, "POST CODE");
         frame_postcode.max_page = 10;
 
+        if (platform)
+            getSelectorPosition(hostPosition);
+
         // Synchronously get D-Bus connection
         auto bus = sdbusplus::bus::new_default();
+        std::string serviceName =
+            BOOT_POSTCODE_SERVICE + std::to_string(hostPosition);
+        std::string objectPath =
+            BOOT_POSTCODE_OBJECTPATH + std::to_string(hostPosition);
 
         // Build D-Bus method call
         auto method = bus.new_method_call(
-            "xyz.openbmc_project.State.Boot.PostCode0",  // Target service name
-            "/xyz/openbmc_project/State/Boot/PostCode0", // Object path
-            "xyz.openbmc_project.State.Boot.PostCode",   // Interface name
-            "GetPostCodes");                             // Method name
+            serviceName.c_str(),     // Target service name
+            objectPath.c_str(),      // Object path
+            BOOT_POSTCODE_INTERFACE, // Interface name
+            "GetPostCodes");         // Method name
 
-        method.append(uint16_t(1)); // Add method parameter, assuming it's page
-
+        method.append(uint16_t(1));  // Add method parameter, assuming it's pag
         try
         {
             auto reply = bus.call(method); // Send synchronous method call