From 7e4c05417afa98ebd69738c0158afa21a8068f1e Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 9 May 2016 11:37:12 +0200 Subject: [PATCH] DSD demod: adapt serial com pors scan to Windows --- sdrbase/dsp/dvserialengine.cpp | 16 ++++++++++++++++ sdrbase/dsp/dvserialengine.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/sdrbase/dsp/dvserialengine.cpp b/sdrbase/dsp/dvserialengine.cpp index e2efffe01..819dd0b21 100644 --- a/sdrbase/dsp/dvserialengine.cpp +++ b/sdrbase/dsp/dvserialengine.cpp @@ -45,6 +45,21 @@ DVSerialEngine::~DVSerialEngine() release(); } +#ifdef __WINDOWS__ +void DVSerialEngine::getComList() +{ + m_comList.clear(); + m_comList8250.clear(); + char comCStr[16]; + + // Arbitrarily set the list to the 20 first COM ports + for (int i = 1; i <= 20; i++) + { + sprintf(comCStr, "COM%d", i); + m_comList.push_back(std::string(comCStr)); + } +} +#else std::string DVSerialEngine::get_driver(const std::string& tty) { struct stat st; @@ -156,6 +171,7 @@ void DVSerialEngine::getComList() // serial8250-devices must be probe to check for validity probe_serial8250_comports(m_comList, m_comList8250); } +#endif // __WINDOWS__ bool DVSerialEngine::scan() { diff --git a/sdrbase/dsp/dvserialengine.h b/sdrbase/dsp/dvserialengine.h index 2b2e15874..bee7a2f5c 100644 --- a/sdrbase/dsp/dvserialengine.h +++ b/sdrbase/dsp/dvserialengine.h @@ -48,9 +48,11 @@ private: std::string device; }; +#ifndef __WINDOWS__ static std::string get_driver(const std::string& tty); static void register_comport(std::list& comList, std::list& comList8250, const std::string& dir); static void probe_serial8250_comports(std::list& comList, std::list comList8250); +#endif void getComList(); std::list m_comList;