From 678806fafbcb7f44e0b5fc6d72441044a2b20e53 Mon Sep 17 00:00:00 2001 From: Volodymyr Vorobiov Date: Fri, 23 Feb 2024 15:14:37 +0200 Subject: [MTX-5246] IoT Router 2023: Add 2nd MAC address in mts-io for using by eth1 GP-2271 --- src/Device/Device.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Device') diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp index fca88e7..b2588eb 100644 --- a/src/Device/Device.cpp +++ b/src/Device/Device.cpp @@ -191,6 +191,7 @@ void Device::getSystemTreeJson(const char *dir_name) { */ dInputs.push_back("USER_DIO_IN"); dOutputs.push_back("USER_DIO_OUT"); + mapMacAddress2Iotr(); } } else if (strcmp(d_name, "mac-eth") == 0) { deviceInfoList["macAddress"] = fileData; @@ -362,6 +363,15 @@ void Device::mapFileToCapability() { } } +void Device::mapMacAddress2Iotr() { + std::ifstream file("/sys/devices/platform/mts-io/mac-eth1"); + if (file.is_open()) { + std::string line = ""; + std::getline(file, line); + deviceInfoList["macAddress1"] = line; + } +} + void Device::mapMacAddress2() { std::ifstream file("/sys/devices/platform/mts-io/base/mac-eth"); if (file.is_open()) { -- cgit v1.2.3