Skip to content

Multiple critical bugs in qt-dab 6.10's SoapySDR device handler prevent proper operation with UHD-based devices (LibreSDR/USRP B210). #386

@Supermagnum

Description

@Supermagnum

Environment

  • OS: Ubuntu 24.04
  • qt-dab version: 6.10
  • Device: LibreSDR B210mini (UHD-compatible)
  • SoapySDR: 0.8.1
  • UHD: 4.6.0 / 4.9.0

Bugs Found

Bug 1: Sample Rate Selection Failure

File: sources/devices/soapy/soapy-handler.cpp
Line: 155-157
Severity: Critical

The findDesiredRange() function fails to find 2.048 MHz in the B210's supported sample rate ranges, causing "no suitable samplerate found" error.

Root Cause:

  • B210 returns continuous rate ranges, not discrete values
  • findDesiredRange() checks if 2048000 is within range min/max but the function logic has issues
  • Falls back to 2.285714 MHz (16/7 MHz) which is incompatible with DAB

Current Code:

int resultRate = findDesiredRange (sampleRange, length);
if (resultRate < 0) 
   throw (device_exception ("no suitable samplerate found"));

Workaround Applied:

int resultRate = 2048000;  // Force exact DAB sample rate

Proper Fix Needed:

  • Improve findDesiredRange() to handle continuous ranges properly
  • Or allow manual sample rate override in GUI
  • Add debug output showing available ranges

Bug 2: Audio Device Selected Instead of SDR

File: sources/devices/soapy/soapy-handler.cpp
Lines: 50-63
Severity: Critical

Device enumeration loop breaks after first device found, which is often an audio device, not the SDR.

Current Code:

for (size_t i = 0; i < length; i++) {
   // ... enumerate device ...
   if (QString (results [i]. keys [j]) == "driver") {
      deviceString = results [i]. vals [j];
      deviceNameLabel -> setText (deviceString);
   }
   // ...
   break;  // BUG: Always takes first device!
}

Workaround Applied:

for (size_t i = 0; i < length; i++) {
   // ... get driver name into currentDriver ...
   if (currentDriver == "audio") {
      fprintf (stderr, "Skipping audio device\n");
      continue;  // Skip audio, find real SDR
   }
   deviceString = currentDriver;
   // ...
   break;
}

Proper Fix Needed:

  • Present device selection dialog to user
  • Save selected device in config
  • Allow device preference order in settings

Bug 3: isFileInput() Returns True

File: sources/devices/soapy/soapy-handler.cpp
Line: 231
Severity: Critical

The isFileInput() function incorrectly returns true, telling qt-dab this is a file reader, not a live SDR device. This disables:

  • Channel scanning
  • Channel selection dropdown
  • Live tuning
  • All real-time DAB features

Current Code:

bool soapyHandler::isFileInput() {
    return true;  // BUG: Should be false for SDR!
}

Fix Applied:

bool soapyHandler::isFileInput() {
    return false;
}

Impact: Without this fix, the SoapySDR handler is completely non-functional for live reception.


Bug 4: Missing C++ Standard Headers

File: sources/protection/protection.cpp
Severity: Moderate (compilation error)

Missing #include <cstdio> causes compilation failure with modern compilers.

Fix: Add #include <cstdio> after existing includes.


Bug 5: C++20/Qwt 6.1.4 Incompatibility

File: qt-dab-6.10.pro
Line: 13
Severity: Moderate (compilation error)

Template destructor syntax in Qwt 6.1.4 incompatible with C++20 standard.

Current: CONFIG += c++20
Fix: CONFIG += c++17


Bug 6: UHD Handler Compilation Errors

File: sources/devices/uhd/uhd-handler.cpp
Severity: Major (if UHD enabled)

Multiple issues:

  • Includes wrong header: virtual-input.h should be device-handler.h
  • Typo: std:atomic should be std::atomic
  • Typo: ~uhdInput should be ~uhdHandler

Workaround: Disable UHD handler, use SoapySDR instead (which supports UHD devices).


Reproduction Steps

  1. Install qt-dab 6.10 on Ubuntu 24.04
  2. Connect LibreSDR B210 or USRP B210
  3. Enable SoapySDR support in compilation
  4. Attempt to run qt-dab with SoapySDR device
  5. Observe: "no suitable samplerate found" error
  6. Fix sample rate issue
  7. Observe: Audio device selected instead of SDR
  8. Fix device selection
  9. Observe: GUI opens but channel selector disabled (isFileInput bug)

Expected Behavior

  • SoapySDR/UHD devices should work out-of-the-box
  • Should select correct SDR device automatically
  • Should support 2.048 MHz sample rate for DAB
  • Should allow live channel scanning and tuning

Actual Behavior

  • Three critical bugs prevent any operation
  • Requires source code modifications to work
  • No live reception possible without fixes

Suggested Long-term Fixes

  1. Device Selection Dialog: Add proper device chooser for SoapySDR
  2. Sample Rate Handling: Improve range detection or add manual override
  3. Code Review: Audit all device handlers for similar issues
  4. Testing: Test with actual SoapySDR/UHD hardware before release
  5. Documentation: Note known issues with specific device types

Current Status After Fixes

Device initializes correctly with 2.048 MHz sample rate at 32.768 MHz master clock, but still no DAB signal reception. Further investigation needed for:

  • Antenna configuration (TX/RX vs RX2 selection)
  • Frequency offset/calibration
  • Signal strength/gain settings
  • TPEG data extraction configuration

Files Modified for Workaround

  1. qt-dab-6.10.pro - Changed C++20 to C++17
  2. sources/protection/protection.cpp - Added cstdio include
  3. sources/devices/soapy/soapy-handler.cpp - All three critical fixes
  4. sources/devices/soapy/soapy-converter.cpp - Added dab-constants.h include

PS: This might be relevant:
https://forums.linuxmint.com/viewtopic.php?p=2730350#p2730350

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions