From 08ab73c1c0b273d6609424e5397d5b36e7ceb84b Mon Sep 17 00:00:00 2001 From: Tom Early Date: Tue, 18 Jan 2022 06:12:03 -0700 Subject: [PATCH] fixes for device queries --- Controller.cpp | 11 ++++++++--- DVSIDevice.cpp | 2 +- DVSIDevice.h | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Controller.cpp b/Controller.cpp index 13f5629..6a8f6dd 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -157,13 +157,12 @@ bool CController::InitVocoders() { if (desc.compare(0, 9, "USB-3006 ")) // the USB-3006 device doesn't need this check { - std::cerr << "Both devices have to be the same type: " << desc << " != " << deviceset.back().second << std::endl; - return true; + std::cout << "Both devices should to be the same type: " << desc << " != " << deviceset.back().second << std::endl; } } Edvtype dvtype = Edvtype::dv3003; - if (0==desc.compare("ThumbDV") || 0==desc.compare("DVstick-30") || 0==desc.compare("USB-3000")) + if (0==desc.compare("ThumbDV") || 0==desc.compare("DVstick-30") || 0==desc.compare("USB-3000") || desc.compare("FT230X Basic UART")) dvtype = Edvtype::dv3000; if (modules.size() > ((Edvtype::dv3000 == dvtype) ? 1 : 3)) @@ -201,6 +200,12 @@ bool CController::InitVocoders() } } + if (dstar_device->GetProductID().compare(dmrsf_device->GetProductID())) + { + std::cerr << "Both devices must have the same DVSI product ID: " << dstar_device->GetProductID() << " != " << dmrsf_device->GetProductID() << std::endl; + return true; + } + // and start them up! dstar_device->Start(); dmrsf_device->Start(); diff --git a/DVSIDevice.cpp b/DVSIDevice.cpp index b8ac791..a9fdf0c 100644 --- a/DVSIDevice.cpp +++ b/DVSIDevice.cpp @@ -348,7 +348,7 @@ bool CDVDevice::InitDevice() dump("Product ID Response Packet", &responsePacket, packet_size(responsePacket)); return true; } - const std::string productid(responsePacket.payload.ctrl.data.prodid); + productid.assign(responsePacket.payload.ctrl.data.prodid); ctrlPacket.field_id = PKT_VERSTRING; status = FT_Write(ftHandle, &ctrlPacket, 5, &written); diff --git a/DVSIDevice.h b/DVSIDevice.h index 4232fe0..8875840 100644 --- a/DVSIDevice.h +++ b/DVSIDevice.h @@ -36,6 +36,7 @@ public: void Start(); void CloseDevice(); void AddPacket(const std::shared_ptr packet); + std::string GetProductID() { return productid; } protected: const Encoding type; @@ -44,7 +45,7 @@ protected: std::atomic keep_running; CPacketQueue input_queue; std::future feedFuture, readFuture; - std::string description; + std::string description, productid; bool DiscoverFtdiDevices(); bool ConfigureVocoder(uint8_t pkt_ch, Encoding type);