From 7876f3401398ef4db6f520c685527ef08a94eed4 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sun, 16 Jan 2022 16:33:06 -0700 Subject: [PATCH] Changed waiting loop in ReadDevice --- DVSIDevice.cpp | 26 ++++++++++---------------- README.md | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/DVSIDevice.cpp b/DVSIDevice.cpp index adffb80..11da48f 100644 --- a/DVSIDevice.cpp +++ b/DVSIDevice.cpp @@ -219,7 +219,7 @@ bool CDVDevice::OpenDevice(const std::string &serialno, const std::string &desc, return true; } - // No timeouts! we want blocking FT_Read + // NO TIMEOUTS! We are using blocking I/O!!! // status = FT_SetTimeouts(ftHandle, 200, 200 ); // if (status != FT_OK) // { @@ -448,7 +448,7 @@ bool CDVDevice::ConfigureVocoder(uint8_t pkt_ch, Encoding type) return true; }; - std::cout << description << " channel " << (unsigned int)(pkt_ch - PKT_CHANNEL0) << " is now configured for " << ((Encoding::dstar == type) ? "D-Star" : "DMR") << std::endl; + std::cout << description << " channel " << (unsigned int)(pkt_ch - PKT_CHANNEL0) << " is now configured for " << ((Encoding::dstar == type) ? "D-Star" : "DMR/YSF") << std::endl; return false; } @@ -609,25 +609,19 @@ void CDVDevice::ReadDevice() DWORD RxBytes = 0; while (0 == RxBytes) { - EVENT_HANDLE eh; - pthread_mutex_init(&eh.eMutex, NULL); - pthread_cond_init(&eh.eCondVar, NULL); - DWORD EventMask = FT_EVENT_RXCHAR; - auto status = FT_SetEventNotification(ftHandle, EventMask, &eh); + auto status = FT_GetQueueStatus(ftHandle, &RxBytes); if (FT_OK != status) { - FTDI_Error("Setting Event Notification", status); + FTDI_Error("FT_GetQueueStatus", status); } - pthread_mutex_lock(&eh.eMutex); - pthread_cond_wait(&eh.eCondVar, &eh.eMutex); - pthread_mutex_unlock(&eh.eMutex); - - DWORD EventDWord, TxBytes, Status; - status = FT_GetStatus(ftHandle, &RxBytes, &TxBytes, &EventDWord); - if (FT_OK != status) + if (RxBytes) + { + break; + } + else { - FTDI_Error("Getting Event Status", status); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } } diff --git a/README.md b/README.md index 85a674e..533e3ec 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Currently, only two AMBE devices are supported. You cannot use a 3003 and a 3000 To be clear, a pair of 3000-based devices will support only a single transcoded reflector channel, while a pair of 3003-based devices will support up to three transcoded reflector channels. -Currently, this program must be run locally with its paired URF reflector. Remote transcoding is not yet possible. +Currently, this program must be run locally with its paired URF reflector. Remote transcoding is not yet supported. Only systemd-based operating systems are supported. Debian or Ubuntu is recommended. If you want to install this on a non-systemd based OS, you are on your own. Also, by default, tcd is built without gdb support.