From 710718682f7a77b3098a95059918d31a9b0c551c Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 16 Nov 2018 11:19:04 +0100 Subject: [PATCH] SoapySDR support: if no label is registered for the device then create one with the driver name and sequence --- devices/soapysdr/devicesoapysdrscan.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devices/soapysdr/devicesoapysdrscan.cpp b/devices/soapysdr/devicesoapysdrscan.cpp index 61b44d0c2..234f6e6ef 100644 --- a/devices/soapysdr/devicesoapysdrscan.cpp +++ b/devices/soapysdr/devicesoapysdrscan.cpp @@ -66,15 +66,17 @@ void DeviceSoapySDRScan::scan() SoapySDR::Kwargs::const_iterator kargIt; - if ((kargIt = kit->find("label")) != kit->end()) - { + if ((kargIt = kit->find("label")) != kit->end()) { m_deviceEnums.back().m_label = QString(kargIt->second.c_str()); - qDebug("DeviceSoapySDRScan::scan: %s #%u %s", - m_deviceEnums.back().m_driverName.toStdString().c_str(), - deviceSeq, - kargIt->second.c_str()); + } else { // if no label is registered for this device then create a label with the driver name and sequence + m_deviceEnums.back().m_label = QString("%1-%2").arg(m_deviceEnums.back().m_driverName).arg(deviceSeq); } + qDebug("DeviceSoapySDRScan::scan: %s #%u %s", + m_deviceEnums.back().m_driverName.toStdString().c_str(), + deviceSeq, + m_deviceEnums.back().m_label.toStdString().c_str()); + if ((kargIt = kit->find("serial")) != kit->end()) { m_deviceEnums.back().m_idKey = QString(kargIt->first.c_str());