1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

Merge pull request #1566 from srcejon/b210_speedup

Speed up enumeration / opening USRP B210 by using hardcoded values.
This commit is contained in:
Edouard Griffiths 2023-01-16 07:04:47 +01:00 committed by GitHub
commit 9350bcd949
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 11 deletions

View File

@ -47,10 +47,27 @@ void DeviceUSRP::enumOriginDevices(const QString& hardwareId, PluginInterface::O
QString id = QString::fromStdString(dev_addrs[i].to_string());
QString name = QString::fromStdString(dev_addrs[i].get("name", "N/A"));
QString serial = QString::fromStdString(dev_addrs[i].get("serial", "N/A"));
QString product = QString::fromStdString(dev_addrs[i].get("product", "N/A"));
QString displayedName(QString("%1[%2:$1] %3").arg(name).arg(i).arg(serial));
qDebug() << "DeviceUSRP::enumOriginDevices: found USRP device " << displayedName;
// Opening some devices can be a little slow, so use hardcoded number of channels,
// for known devices
static const QMap<QString, int> channelMap{{"B200", 1}, {"B205", 1}, {"B210", 2}};
if (channelMap.contains(product))
{
originDevices.append(PluginInterface::OriginDevice(
displayedName,
hardwareId,
id,
(int)i,
channelMap[product],
channelMap[product]
));
}
else
{
DeviceUSRPParams usrpParams;
usrpParams.open(id, true);
usrpParams.close();
@ -65,6 +82,7 @@ void DeviceUSRP::enumOriginDevices(const QString& hardwareId, PluginInterface::O
));
}
}
}
catch (const std::exception& e)
{
qDebug() << "DeviceUSRP::enumOriginDevices: exception: " << e.what();

View File

@ -71,6 +71,12 @@ bool DeviceUSRPParams::open(const QString &deviceStr, bool channelNumOnly)
m_srRangeTx = m_dev->get_tx_rates();
}
}
else if (deviceStr.contains("product=B210"))
{
// Auto-calculation below can be slow, so use hardcoded values for B210
m_srRangeRx = uhd::meta_range_t(1e5, 61.444e6);
m_srRangeTx = uhd::meta_range_t(1e5, 61.444e6);
}
else
{
// Find max and min sample rate, for max and min master clock rates