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 --- include/Device/Device.h | 1 + src/Device/Device.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/Device/Device.h b/include/Device/Device.h index 42dad24..bcf0cff 100644 --- a/include/Device/Device.h +++ b/include/Device/Device.h @@ -164,6 +164,7 @@ class Device { void mapFileToCapability(); void mapFirmware(); void mapMacAddress2(); + void mapMacAddress2Iotr(); void printDir(const std::string dir_name, std::vector &results); void printJson(); 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