summaryrefslogtreecommitdiff
path: root/src/Device
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2020-06-03 12:31:49 -0500
committerHarsh Sharma <harsh.sharma@multitech.com>2020-06-03 12:31:49 -0500
commitc5abeaec92af0135c624eb6b804d096c4162ac30 (patch)
treec0a32e0f0f7be119facca0a018d2fa8dceb363f5 /src/Device
parentca05c8e1ce5f902b3b40031bd6e7b952b21bc246 (diff)
downloadmts-io-sysfs-c5abeaec92af0135c624eb6b804d096c4162ac30.tar.gz
mts-io-sysfs-c5abeaec92af0135c624eb6b804d096c4162ac30.tar.bz2
mts-io-sysfs-c5abeaec92af0135c624eb6b804d096c4162ac30.zip
Bug fix: GP-6820.1.8
Diffstat (limited to 'src/Device')
-rw-r--r--src/Device/Device.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp
index d3eb4ab..6c589a5 100644
--- a/src/Device/Device.cpp
+++ b/src/Device/Device.cpp
@@ -84,11 +84,13 @@ void Device::getSystemTreeJson(const char * dir_name) {
if (isAccessoryCard(d_name, dir_name)) {
if (accessoryCard.IsNull()) {
accessoryCard.SetObject();
- } else if (accessoryCard.HasMember(d_name)) {
+ accessoryCard.AddMember("port", rapidjson::Value().SetString(dir_name, accessoryCardsAlloc), accessoryCardsAlloc);
+ } else if (accessoryCard["port"] != dir_name) {
accessoryCards.PushBack(accessoryCard, accessoryCardsAlloc);
accessoryCard.SetObject();
+ accessoryCard.AddMember("port", rapidjson::Value().SetString(dir_name, accessoryCardsAlloc), accessoryCardsAlloc);
}
- if (strcmp(d_name, "product-id") == 0) {
+ if (strcmp(d_name, "product-id") == 0) { // Map additional details based on product id not found in mts-io dir
if (regex_match(fileData, loraG16Filters)) {
Lora21Card lora21(*this, fileData, dir_name);
} else if (regex_match(fileData, loraG64Filters)) {
@@ -117,11 +119,11 @@ void Device::getSystemTreeJson(const char * dir_name) {
}
}
}
- if (isValidDirectory(entry, fullPath, d_name)) { /* Check that the directory is not "d" or d's parent. */
- getSystemTreeJson(d_name); /* Recursively call with the new path */
+ if (isValidDirectory(entry, fullPath, d_name)) { // Check that the directory is not "d" or d's parent.
+ getSystemTreeJson(d_name); // Recursively call with the new path
}
}
- if (closedir (d)) { /* After going through all the entries, close the directory. */
+ if (closedir (d)) { // After going through all the entries, close the directory.
logError("Could not close " + std::string(fullPath));
exitHandler(errno);
}