mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-05-14 21:32:41 -04:00
Merge pull request #2699 from f4exb/fix-2686
PlutoSDR: filter PlutoSDR and AD93 device description to catch also PlutoSDR clones.
This commit is contained in:
commit
82b43ff2f4
@ -22,6 +22,7 @@
|
||||
#include <cstring>
|
||||
#include <regex>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
#include <iio.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
@ -53,6 +54,7 @@ void DevicePlutoSDRScan::scan()
|
||||
|
||||
m_scans.clear();
|
||||
m_scans.reserve(num_contexts);
|
||||
qDebug("PlutoSDRScan::scan: found %d contexts", num_contexts);
|
||||
|
||||
for (i = 0; i < num_contexts; i++)
|
||||
{
|
||||
@ -64,9 +66,12 @@ void DevicePlutoSDRScan::scan()
|
||||
}
|
||||
|
||||
qDebug("PlutoSDRScan::scan: %d: %s [%s]", i, description, uri);
|
||||
char *pch = strstr(const_cast<char*>(description), "PlutoSDR");
|
||||
const std::string_view descriptionView = description ? std::string_view{description} : std::string_view{};
|
||||
const bool isPlutoDescription =
|
||||
(descriptionView.find("PlutoSDR") != std::string_view::npos) ||
|
||||
(descriptionView.find("AD93") != std::string_view::npos);
|
||||
|
||||
if (pch)
|
||||
if (isPlutoDescription)
|
||||
{
|
||||
// As device scan is used across multiple vectors it's best to use a
|
||||
// managed pointer, as to keep track of when it's safe to delete.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user