diff options
author | Harsh Sharma <harsh.sharma@multitech.com> | 2022-03-10 15:36:48 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2022-03-10 15:35:25 -0600 |
commit | 17e3209a015e2f23b655b860917a1d2dffcd6040 (patch) | |
tree | 8e92a21fd7c4f54ca3c417defdee45e31021ae13 | |
parent | 0be7f765704e57ec50e020a41bf513d090382999 (diff) | |
download | mts-io-sysfs-17e3209a015e2f23b655b860917a1d2dffcd6040.tar.gz mts-io-sysfs-17e3209a015e2f23b655b860917a1d2dffcd6040.tar.bz2 mts-io-sysfs-17e3209a015e2f23b655b860917a1d2dffcd6040.zip |
Added mtcap default case for 2.4g card in case it is added in the future0.2.2
-rw-r--r-- | src/AccessoryCards/LoraCard2G4.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/AccessoryCards/LoraCard2G4.cpp b/src/AccessoryCards/LoraCard2G4.cpp index 7653dbf..2ca8c28 100644 --- a/src/AccessoryCards/LoraCard2G4.cpp +++ b/src/AccessoryCards/LoraCard2G4.cpp @@ -23,8 +23,29 @@ Device::Lora2G4Card::Lora2G4Card(Device &d) void Device::Lora2G4Card::AddToDeviceInfo(const std::string Port, const std::string ProductID) { + std::string ttyPath; + + if (ProductID.rfind("MTCAP", 0) == 0) { + /* + Set to default value in case it is supported in + the future + */ + ttyPath = "/dev/ttyACM0"; + } else { + /* + Set path based on mtcdt rules. + Path is linked to a AP hardware path + so that additional installed usb devices do + not cause any bugs dependant on usb load order + */ + std::string ttyPathBase = "/dev/ttyLora"; + std::string ttyPathExtension = Port; + for (auto & c: ttyPathExtension) c = toupper(c); + ttyPath = ttyPathBase + ttyPathExtension; + } + LoraCard::AddToDeviceInfo(Port, ProductID); - std::string ttyPath = "/dev/ttyLoraAP" + Port; + device.accessoryCard.AddMember( "ttyPath", rapidjson::Value().SetString(ttyPath.c_str(), device.acAlloc), |