diff options
author | John Klug <john.klug@multitech.com> | 2024-02-23 16:44:24 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2024-02-23 16:44:24 -0600 |
commit | 3cd85e811ffcdd481cae20c76c045134b0ba3f3d (patch) | |
tree | b59633d3d30663d6b9f3240792c2fcf2739e0f99 | |
parent | 404810002f0b4ce92a027376f946f077eefefb27 (diff) | |
parent | 678806fafbcb7f44e0b5fc6d72441044a2b20e53 (diff) | |
download | mts-io-sysfs-3cd85e811ffcdd481cae20c76c045134b0ba3f3d.tar.gz mts-io-sysfs-3cd85e811ffcdd481cae20c76c045134b0ba3f3d.tar.bz2 mts-io-sysfs-3cd85e811ffcdd481cae20c76c045134b0ba3f3d.zip |
Merge branch 'vv/iotr_mac_eth1' into 'master'
[MTX-5246] IoT Router 2023: Add 2nd MAC address in mts-io for using by eth1 GP-2271
See merge request !18
-rw-r--r-- | include/Device/Device.h | 1 | ||||
-rw-r--r-- | src/Device/Device.cpp | 10 |
2 files changed, 11 insertions, 0 deletions
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<std::string> &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()) { |