summaryrefslogtreecommitdiff
path: root/src/AccessoryCards
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2020-11-06 09:23:42 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2020-11-06 09:23:42 -0600
commitf13e498b07f525c9e74e735761efc3150ab45224 (patch)
treee31cfe60901c4aff0263b074faa1f0299bebcd77 /src/AccessoryCards
parentc730b023549d32899e2831ac6ca03ce91d34201a (diff)
downloadmts-io-sysfs-f13e498b07f525c9e74e735761efc3150ab45224.tar.gz
mts-io-sysfs-f13e498b07f525c9e74e735761efc3150ab45224.tar.bz2
mts-io-sysfs-f13e498b07f525c9e74e735761efc3150ab45224.zip
Fixed spi path and fpga version functionality for mtcdt3
Diffstat (limited to 'src/AccessoryCards')
-rw-r--r--src/AccessoryCards/LoraCard15.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/AccessoryCards/LoraCard15.cpp b/src/AccessoryCards/LoraCard15.cpp
index 69efb6b..cb7dc64 100644
--- a/src/AccessoryCards/LoraCard15.cpp
+++ b/src/AccessoryCards/LoraCard15.cpp
@@ -19,8 +19,15 @@
Device::Lora15Card::Lora15Card(Device& d, const std::string ProductId, const std::string Port) : LoraCard(d, ProductId, Port) {
int ret;
- if ((productId.rfind("MTCDT3-", 0) == 0 || productId.rfind("MTLGA-", 0) == 0) && (port.back() == '2')) {
- spiPath = "/dev/spidev1.0";
+ std::string deviceProductId = "";
+ /* Map the spi path to the device and card product id, with the default being spidev0.0 */
+ MTS::System::readFile(PRODUCT_ID_PATH, deviceProductId);
+ if (deviceProductId.find("MTCDT3-") != std::string::npos) {
+ if (port.back() == '2') {
+ spiPath = "/dev/spidev1.2";
+ } else {
+ spiPath = "/dev/spidev0.2";
+ }
} else if (productId.find("MTAC-LORA-") == 0) {
if (port.back() == '2') {
spiPath = "/dev/spidev32765.2";
@@ -37,6 +44,7 @@ Device::Lora15Card::Lora15Card(Device& d, const std::string ProductId, const std
ret = spiRead(MTAC_FPGA_ADDRESS, &fpgaVersion);
if (ret != 0) {
printf("Could not read FPGA version");
+ fpgaVersion = 255;
}
spiClose();