diff options
-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), |