diff options
Diffstat (limited to 'src/Device/Device.cpp')
-rw-r--r-- | src/Device/Device.cpp | 12 |
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); } |