summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2022-03-10 15:36:48 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2022-03-10 15:36:48 -0600
commitc3a72c83d08899aca324004b888f471688e7116b (patch)
tree8e92a21fd7c4f54ca3c417defdee45e31021ae13
parent366ef4b67a7b8b64fa57ef76af5ab66e98821dbe (diff)
downloadmts-io-sysfs-c3a72c83d08899aca324004b888f471688e7116b.tar.gz
mts-io-sysfs-c3a72c83d08899aca324004b888f471688e7116b.tar.bz2
mts-io-sysfs-c3a72c83d08899aca324004b888f471688e7116b.zip
Added mtcap default case for 2.4g card in case it is added in the future
-rw-r--r--src/AccessoryCards/LoraCard2G4.cpp23
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),