1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Speed up enumeration / opening USRP B210 by using hardcoded values.

This commit is contained in:
Jon Beniston 2023-01-15 19:45:44 +00:00
parent 0a257f393e
commit aeaf0e75c0
2 changed files with 35 additions and 11 deletions

View File

@ -47,22 +47,40 @@ 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;
DeviceUSRPParams usrpParams;
usrpParams.open(id, true);
usrpParams.close();
// 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();
originDevices.append(PluginInterface::OriginDevice(
displayedName,
hardwareId,
id,
(int)i,
usrpParams.m_nbRxChannels,
usrpParams.m_nbTxChannels
));
originDevices.append(PluginInterface::OriginDevice(
displayedName,
hardwareId,
id,
(int)i,
usrpParams.m_nbRxChannels,
usrpParams.m_nbTxChannels
));
}
}
}
catch (const std::exception& e)

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