1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-12 02:32:25 -04:00

DSD demod: adapt serial com pors scan to Windows

This commit is contained in:
f4exb 2016-05-09 11:37:12 +02:00
parent 195a42460b
commit 7e4c05417a
2 changed files with 18 additions and 0 deletions

View File

@ -45,6 +45,21 @@ DVSerialEngine::~DVSerialEngine()
release(); 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) std::string DVSerialEngine::get_driver(const std::string& tty)
{ {
struct stat st; struct stat st;
@ -156,6 +171,7 @@ void DVSerialEngine::getComList()
// serial8250-devices must be probe to check for validity // serial8250-devices must be probe to check for validity
probe_serial8250_comports(m_comList, m_comList8250); probe_serial8250_comports(m_comList, m_comList8250);
} }
#endif // __WINDOWS__
bool DVSerialEngine::scan() bool DVSerialEngine::scan()
{ {

View File

@ -48,9 +48,11 @@ private:
std::string device; std::string device;
}; };
#ifndef __WINDOWS__
static std::string get_driver(const std::string& tty); static std::string get_driver(const std::string& tty);
static void register_comport(std::list<std::string>& comList, std::list<std::string>& comList8250, const std::string& dir); static void register_comport(std::list<std::string>& comList, std::list<std::string>& comList8250, const std::string& dir);
static void probe_serial8250_comports(std::list<std::string>& comList, std::list<std::string> comList8250); static void probe_serial8250_comports(std::list<std::string>& comList, std::list<std::string> comList8250);
#endif
void getComList(); void getComList();
std::list<std::string> m_comList; std::list<std::string> m_comList;