mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-01 05:22:26 -04:00
SoapySDR support: set enumeration serial to driver and sequence so buddies are paired appropriately
This commit is contained in:
parent
8f2ec099f3
commit
d8b82ddecd
@ -60,33 +60,35 @@ void DeviceSoapySDRScan::scan()
|
|||||||
{
|
{
|
||||||
m_deviceEnums.push_back(SoapySDRDeviceEnum());
|
m_deviceEnums.push_back(SoapySDRDeviceEnum());
|
||||||
m_deviceEnums.back().m_driverName = QString(it.first.c_str());
|
m_deviceEnums.back().m_driverName = QString(it.first.c_str());
|
||||||
|
m_deviceEnums.back().m_sequence = deviceSeq;
|
||||||
|
|
||||||
// collect identification information
|
// collect identification information
|
||||||
for (SoapySDR::Kwargs::const_iterator kargIt = kit->begin(); kargIt != kit->end(); ++kargIt)
|
|
||||||
|
SoapySDR::Kwargs::const_iterator kargIt;
|
||||||
|
|
||||||
|
if ((kargIt = kit->find("label")) != kit->end())
|
||||||
{
|
{
|
||||||
if (kargIt->first == "label")
|
m_deviceEnums.back().m_label = QString(kargIt->second.c_str());
|
||||||
{
|
qDebug("DeviceSoapySDRScan::scan: %s #%u %s",
|
||||||
m_deviceEnums.back().m_label = QString(kargIt->second.c_str());
|
m_deviceEnums.back().m_driverName.toStdString().c_str(),
|
||||||
qDebug("DeviceSoapySDRScan::scan: %s #%u %s",
|
deviceSeq,
|
||||||
m_deviceEnums.back().m_driverName.toStdString().c_str(),
|
kargIt->second.c_str());
|
||||||
deviceSeq,
|
}
|
||||||
kargIt->second.c_str());
|
|
||||||
}
|
if ((kargIt = kit->find("serial")) != kit->end())
|
||||||
else if ((m_deviceEnums.back().m_idKey.size() == 0) && (kargIt->first == "serial"))
|
{
|
||||||
{
|
m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());
|
||||||
m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());
|
m_deviceEnums.back().m_idValue = QString(kargIt->second.c_str());
|
||||||
m_deviceEnums.back().m_idValue = QString(kargIt->second.c_str());
|
}
|
||||||
}
|
else if ((kargIt = kit->find("device_id")) != kit->end())
|
||||||
else if ((m_deviceEnums.back().m_idKey.size() == 0) && (kargIt->first == "device_id"))
|
{
|
||||||
{
|
m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());
|
||||||
m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());
|
m_deviceEnums.back().m_idValue = QString(kargIt->second.c_str());
|
||||||
m_deviceEnums.back().m_idValue = QString(kargIt->second.c_str());
|
}
|
||||||
}
|
else if ((kargIt = kit->find("addr")) != kit->end())
|
||||||
else if ((m_deviceEnums.back().m_idKey.size() == 0) && (kargIt->first == "addr"))
|
{
|
||||||
{
|
m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());
|
||||||
m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());
|
m_deviceEnums.back().m_idValue = QString(kargIt->second.c_str());
|
||||||
m_deviceEnums.back().m_idValue = QString(kargIt->second.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// access the device to get the number of Rx and Tx channels and at the same time probe
|
// access the device to get the number of Rx and Tx channels and at the same time probe
|
||||||
|
@ -29,13 +29,14 @@ public:
|
|||||||
struct SoapySDRDeviceEnum
|
struct SoapySDRDeviceEnum
|
||||||
{
|
{
|
||||||
QString m_driverName;
|
QString m_driverName;
|
||||||
QString m_label; //!< the label key for display should always be present
|
uint32_t m_sequence; //!< device sequence for this driver
|
||||||
QString m_idKey; //!< key to uniquely identify device
|
QString m_label; //!< the label key for display should always be present
|
||||||
QString m_idValue; //!< value for the above key
|
QString m_idKey; //!< key to uniquely identify device
|
||||||
|
QString m_idValue; //!< value for the above key
|
||||||
uint32_t m_nbRx;
|
uint32_t m_nbRx;
|
||||||
uint32_t m_nbTx;
|
uint32_t m_nbTx;
|
||||||
|
|
||||||
SoapySDRDeviceEnum() : m_nbRx(0), m_nbTx(0)
|
SoapySDRDeviceEnum() : m_sequence(0), m_nbRx(0), m_nbTx(0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ PluginInterface::SamplingDevices SoapySDROutputPlugin::enumSampleSinks()
|
|||||||
SamplingDevices result;
|
SamplingDevices result;
|
||||||
DeviceSoapySDR& deviceSoapySDR = DeviceSoapySDR::instance();
|
DeviceSoapySDR& deviceSoapySDR = DeviceSoapySDR::instance();
|
||||||
const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& devicesEnumeration = deviceSoapySDR.getDevicesEnumeration();
|
const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& devicesEnumeration = deviceSoapySDR.getDevicesEnumeration();
|
||||||
qDebug("SoapySDRInputPlugin::enumSampleSources: found %lu devices", devicesEnumeration.size());
|
qDebug("SoapySDROutputPlugin::enumSampleSinks: %lu SoapySDR devices. Enumerate these with Tx channel(s):", devicesEnumeration.size());
|
||||||
std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>::const_iterator it = devicesEnumeration.begin();
|
std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>::const_iterator it = devicesEnumeration.begin();
|
||||||
|
|
||||||
for (int idev = 0; it != devicesEnumeration.end(); ++it, idev++)
|
for (int idev = 0; it != devicesEnumeration.end(); ++it, idev++)
|
||||||
@ -70,12 +70,14 @@ PluginInterface::SamplingDevices SoapySDROutputPlugin::enumSampleSinks()
|
|||||||
|
|
||||||
for (unsigned int ichan = 0; ichan < nbTxChannels; ichan++)
|
for (unsigned int ichan = 0; ichan < nbTxChannels; ichan++)
|
||||||
{
|
{
|
||||||
qDebug("SoapySDROutputPlugin::enumSampleSinks: device #%d (%s) channel %u", idev, it->m_label, ichan);
|
|
||||||
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg(ichan).arg(it->m_label));
|
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg(ichan).arg(it->m_label));
|
||||||
|
QString serial(QString("%1-%2").arg(it->m_driverName).arg(it->m_sequence));
|
||||||
|
qDebug("SoapySDROutputPlugin::enumSampleSinks: device #%d (%s) serial %s channel %u",
|
||||||
|
idev, it->m_label.toStdString().c_str(), serial.toStdString().c_str(), ichan);
|
||||||
result.append(SamplingDevice(displayedName,
|
result.append(SamplingDevice(displayedName,
|
||||||
m_hardwareID,
|
m_hardwareID,
|
||||||
m_deviceTypeID,
|
m_deviceTypeID,
|
||||||
it->m_idValue,
|
serial,
|
||||||
idev,
|
idev,
|
||||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||||
false,
|
false,
|
||||||
|
@ -60,7 +60,7 @@ PluginInterface::SamplingDevices SoapySDRInputPlugin::enumSampleSources()
|
|||||||
SamplingDevices result;
|
SamplingDevices result;
|
||||||
DeviceSoapySDR& deviceSoapySDR = DeviceSoapySDR::instance();
|
DeviceSoapySDR& deviceSoapySDR = DeviceSoapySDR::instance();
|
||||||
const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& devicesEnumeration = deviceSoapySDR.getDevicesEnumeration();
|
const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& devicesEnumeration = deviceSoapySDR.getDevicesEnumeration();
|
||||||
qDebug("SoapySDRInputPlugin::enumSampleSources: found %lu devices", devicesEnumeration.size());
|
qDebug("SoapySDRInputPlugin::enumSampleSources: %lu SoapySDR devices. Enumerate these with Rx channel(s):", devicesEnumeration.size());
|
||||||
std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>::const_iterator it = devicesEnumeration.begin();
|
std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>::const_iterator it = devicesEnumeration.begin();
|
||||||
|
|
||||||
for (int idev = 0; it != devicesEnumeration.end(); ++it, idev++)
|
for (int idev = 0; it != devicesEnumeration.end(); ++it, idev++)
|
||||||
@ -69,12 +69,14 @@ PluginInterface::SamplingDevices SoapySDRInputPlugin::enumSampleSources()
|
|||||||
|
|
||||||
for (unsigned int ichan = 0; ichan < nbRxChannels; ichan++)
|
for (unsigned int ichan = 0; ichan < nbRxChannels; ichan++)
|
||||||
{
|
{
|
||||||
qDebug("SoapySDRInputPlugin::enumSampleSources: device #%d (%s) channel %u", idev, it->m_label, ichan);
|
|
||||||
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg(ichan).arg(it->m_label));
|
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg(ichan).arg(it->m_label));
|
||||||
|
QString serial(QString("%1-%2").arg(it->m_driverName).arg(it->m_sequence));
|
||||||
|
qDebug("SoapySDRInputPlugin::enumSampleSources: device #%d (%s) serial %s channel %u",
|
||||||
|
idev, it->m_label.toStdString().c_str(), serial.toStdString().c_str(), ichan);
|
||||||
result.append(SamplingDevice(displayedName,
|
result.append(SamplingDevice(displayedName,
|
||||||
m_hardwareID,
|
m_hardwareID,
|
||||||
m_deviceTypeID,
|
m_deviceTypeID,
|
||||||
it->m_idValue,
|
serial,
|
||||||
idev,
|
idev,
|
||||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||||
true,
|
true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user