diff options
author | John Klug <john.klug@multitech.com> | 2023-01-11 12:18:39 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2023-01-11 12:18:39 -0600 |
commit | 3ebfe17aef57ad6bddb7e7a7d53fc112bfd10b4f (patch) | |
tree | 1482e7819f95aa5bfae8067a09205c9255290a6e | |
parent | f873087849c21d0e3b203d7ced2dbf621af778a0 (diff) | |
parent | 37d7886022d0c90c1102f37ee5dd0704b2276730 (diff) | |
download | mts-io-sysfs-3ebfe17aef57ad6bddb7e7a7d53fc112bfd10b4f.tar.gz mts-io-sysfs-3ebfe17aef57ad6bddb7e7a7d53fc112bfd10b4f.tar.bz2 mts-io-sysfs-3ebfe17aef57ad6bddb7e7a7d53fc112bfd10b4f.zip |
Fix FPGA Loader0.2.7
-rw-r--r-- | include/Device/Device.h | 2 | ||||
-rw-r--r-- | src/AccessoryCards/LoraCard2G4.cpp | 2 | ||||
-rw-r--r-- | src/AccessoryCards/Mtac15Fpga.cpp | 31 | ||||
-rw-r--r-- | src/Device/Device.cpp | 17 |
4 files changed, 23 insertions, 29 deletions
diff --git a/include/Device/Device.h b/include/Device/Device.h index 5f2bf12..7a20f04 100644 --- a/include/Device/Device.h +++ b/include/Device/Device.h @@ -28,7 +28,7 @@ class Device { static const std::regex serialModeFilter; static const std::regex storeFilters; static const std::regex showFilters; - static const std::regex mtcdt3Filters; + static const std::regex mtcdt3HwVersionFilters; static const std::regex mtrFilters; const unsigned int accessoryCardsListSize = 7; diff --git a/src/AccessoryCards/LoraCard2G4.cpp b/src/AccessoryCards/LoraCard2G4.cpp index 2ca8c28..2c9c967 100644 --- a/src/AccessoryCards/LoraCard2G4.cpp +++ b/src/AccessoryCards/LoraCard2G4.cpp @@ -18,7 +18,7 @@ #include "Device.h" Device::Lora2G4Card::Lora2G4Card(Device &d) - : LoraCard(d, std::regex("(MTAC-LORA-2G4)")) {} + : LoraCard(d, std::regex("(MTAC-LORA-2G4)(.*)")){} void Device::Lora2G4Card::AddToDeviceInfo(const std::string Port, const std::string ProductID) { diff --git a/src/AccessoryCards/Mtac15Fpga.cpp b/src/AccessoryCards/Mtac15Fpga.cpp index ed30fe3..ef3b7bd 100644 --- a/src/AccessoryCards/Mtac15Fpga.cpp +++ b/src/AccessoryCards/Mtac15Fpga.cpp @@ -51,28 +51,21 @@ static const char *valid_hashes[3][4] = { { - "d9f811fcab57947db3c2323242885a32a7f095a069d3386a148466e7f3da53" - "53", /* mtcdt v28*/ - "903c1199df46d38683b1aa9fc88310abe2f317c01c3aefa77987990874aba4" - "20", /* mtcdt v31*/ - "7c190506b969aea6198daffb6c9b47685f3a4dc3ce18565c66542bac27d6f2" - "4e", /* mtcdt v33*/ - "72bcdfda72bf8677d585330caa3d609615d08d4ca6d7951f0ebbcb5a93306b" - "3c" /* mtcdt v35*/ + "d9f811fcab57947db3c2323242885a32a7f095a069d3386a148466e7f3da5353", /* v28*/ + "903c1199df46d38683b1aa9fc88310abe2f317c01c3aefa77987990874aba420", /* v31*/ + "7c190506b969aea6198daffb6c9b47685f3a4dc3ce18565c66542bac27d6f24e", /* v33*/ + "72bcdfda72bf8677d585330caa3d609615d08d4ca6d7951f0ebbcb5a93306b3c" /* v35*/ }, { - "54e41b186b2c91f1bcf249648c50357165d361101fc4fe20ee9b8f0c40dce2" - "5d" /* mtcdt3 v35*/ + "903c1199df46d38683b1aa9fc88310abe2f317c01c3aefa77987990874aba420", /* v31*/ + "7c190506b969aea6198daffb6c9b47685f3a4dc3ce18565c66542bac27d6f24e", /* v33*/ + "72bcdfda72bf8677d585330caa3d609615d08d4ca6d7951f0ebbcb5a93306b3c" /* v35*/ }, { - "07317fe9ca59393c074215c9d923d8d01025654883291a5e89b27d21668e22" - "63", /* mtcap v28*/ - "f208ef5cae03e703951bb8799172a5eaadb74ddb90bf3e65c32030c008a88e" - "75", /* mtcap v31*/ - "aaecd468b187703dbbf76022b00268dba2a5f25300da6486d420f476c83638" - "5c", /* mtcap v33*/ - "876cc5683f612c09f96bacb27fff170358c90f3bd76a5c61ec41504eabba83" - "13" /* mtcap v35*/ + "07317fe9ca59393c074215c9d923d8d01025654883291a5e89b27d21668e2263", /* v28*/ + "f208ef5cae03e703951bb8799172a5eaadb74ddb90bf3e65c32030c008a88e75", /* v31*/ + "aaecd468b187703dbbf76022b00268dba2a5f25300da6486d420f476c836385c", /* v33*/ + "876cc5683f612c09f96bacb27fff170358c90f3bd76a5c61ec41504eabba8313" /* v35*/ }, }; @@ -143,7 +136,7 @@ int Mtac15Fpga::sha256_file(const char *path) { for (i = 0; i < sizeof(valid_hashes[hardwareType]) / sizeof(valid_hashes[hardwareType][0]); ++i) { - if (!strcmp(valid_hashes[hardwareType][i], file_hash)) { + if (valid_hashes[hardwareType][i] && !strcmp(valid_hashes[hardwareType][i], file_hash)) { printInfo("File verified"); return 0; } diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp index e4ec02a..6ef807e 100644 --- a/src/Device/Device.cpp +++ b/src/Device/Device.cpp @@ -22,7 +22,7 @@ const std::vector<std::string> Device::apIdentifiers = { const std::regex Device::apFilters("(modalias)|(power)(.*)|(subsystem)|(uevent)"); const std::regex Device::serialModeFilter("(.*)(serial-mode)"); -const std::regex Device::mtcdt3Filters("(MTCDT3AC)(.*)"); +const std::regex Device::mtcdt3HwVersionFilters("(MTCDT3AC)(.*)"); const std::regex Device::mtrFilters("(MTR-)(.*)"); const std::regex Device::storeFilters( "(.*)(mac-)(.*)|(.*)(-id)|(uuid)|(.*)(/eui)|(.*)(/" @@ -54,7 +54,8 @@ std::map<std::string, bool> Device::capabilityList = { {"supercap", false}, {"wifi", false}, {"docker", false}, - {"tpm", false}}; + {"tpm", false}, + {"userDataEncryption", false}}; std::map<std::string, std::string> Device::ethSwitchList; @@ -174,6 +175,12 @@ void Device::getSystemTreeJson(const char *dir_name) { deviceInfoList[toCamelCase(d_name)] = fileData; } else if (strcmp(d_name, "hw-version") == 0) { deviceInfoList["hardwareVersion"] = fileData; + if (regex_match(fileData, mtcdt3HwVersionFilters)) { + capabilityList["rs232"] = true; + capabilityList["rs422"] = true; + capabilityList["rs485"] = true; + capabilityList["serial"] = true; + } } else if (strcmp(d_name, "mac-eth") == 0) { deviceInfoList["macAddress"] = fileData; } else if (strcmp(d_name, "has-radio") == 0 && @@ -185,12 +192,6 @@ void Device::getSystemTreeJson(const char *dir_name) { deviceInfoList["oemString2"] = fileData; }; if (strcmp(d_name, "product-id") == 0) { - if (regex_match(fileData, mtcdt3Filters)) { - capabilityList["rs232"] = true; - capabilityList["rs422"] = true; - capabilityList["rs485"] = true; - capabilityList["serial"] = true; - } if (regex_match(fileData, mtrFilters)) { capabilityList["rs232"] = true; capabilityList["serial"] = true; |