Commit Graph
2004 Commits
Author SHA1 Message Date
Robin Getz 953391c171 repo wide : Name SDRangel-owned threads for debugging
Assign descriptive names to SDRangel threads so thread activity can be
identified when investigating multi-threaded behavior, including crashes,
leaks, and synchronization issues in debuggers and others tools.

Use compact names to fit platform thread-name limits (14 chars) while
retaining the component and thread role where possible.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-26 20:26:27 -04:00
Edouard Griffiths 62ce6c7b88 Merge pull request #2955 from rgetz/rgetz-fix-message-queue-leaks
tree wide: Fix message ownership and reporting for unhandled queue messages
2026-09-27 00:56:58 +02:00
Edouard Griffiths 67a73916ae Merge pull request #2934 from srcejon/mcp
Add MCP Server for Claude & ChatGPT
2026-09-26 10:24:57 +02:00
Robin Getz c2b30d4fa8 tree wide: Fix message ownership and reporting for unhandled queue messages
MessageQueue::pop() transfers ownership of the popped message to the
caller, but many handleInputMessages() implementations only deleted
the message when handleMessage() returned true. When a message was not
handled, ownership had already been transferred from the queue and the
message was leaked.

This was identified while investigating an ASAN leak in the audio
subsystem.

Update the applicable handleInputMessages() implementations to always
delete messages after handleMessage() returns. Unhandled messages are
also logged with the component and message identifier so unexpected
message routing is visible during debugging.

This change:
- Ensures every message popped from a queue has its ownership resolved.
- Prevents leaks when handleMessage() returns false.
- Makes unhandled messages visible instead of silently discarding them.
- Preserves the existing message handling logic and does not require
  components to handle message types that are legitimately irrelevant
  to them.

The changes are intentionally mechanical and limited to the common
message queue ownership and diagnostic pattern.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-25 23:49:05 -04:00
Jon Beniston c79a8fdf47 Fix frequency not being set on Nooelec dongles when first started. 2026-09-15 15:12:14 +01:00
Robin Getz e9ee3d0752 soapysdr[input|output]gui : Remove unused loop counters
Remove unused loop counters from the SoapySDR input and output GUI loops.

The counters were incremented but never used, triggering
-Wunused-but-set-variable compiler warnings.

The loops are already controlled by their iterators, so removing the counters
does not change behavior.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:27 -04:00
Robin Getz 359b17c465 usrpinputthread : Initialize USRP input thread counters
Initialize m_packets, m_overflows, and m_timeouts to zero so the USRP input
thread starts with defined stream status counters.

The counters were previously left uninitialized, allowing stream status
reporting to use indeterminate values.

This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:25 -04:00
Robin Getz c17966762c sdrplayv3thread : Initialize SDRPlay V3 RF change state
Initialize m_rfChanged to zero so the SDRPlay V3 thread starts with a defined
RF change state before RF changes are processed.

The member was previously left uninitialized, allowing RF change state checks
to use an indeterminate value.

This resolves the uninitialized member finding reported by Coverity
(UNINIT_CTOR).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:24 -04:00
Robin Getz fd23a527a5 remotetcpinputtcphandler : Handle invalid RemoteTCP sample sizes
Drop the current input batch when the remote stream reports an unsupported
sample size instead of continuing with an unpopulated conversion buffer.

The existing warning identifies the invalid stream configuration, while the
early return prevents uninitialized data from being written to the
uncompressed data FIFO.

This resolves the uninitialized value finding reported by Coverity (UNINIT).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:24 -04:00
Robin Getz faff27275a remotetcpinputtcphandler : Initialize RemoteTCP input handler state
Initialize the RemoteTCP input handler members that were left undefined so
protocol, decompression, and connection state starts with defined values.

Value-initialize the zlib stream and initialize the remaining uninitialized
members according to their intended initial state.

This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:23 -04:00
Robin Getz f969de26de localinput : Initialize LocalInput sample rate
Initialize m_sampleRate to zero so LocalInput starts with a defined sample rate
before one is configured.

The member was previously left uninitialized, allowing sample rate access to
use an indeterminate value.

This resolves the uninitialized member finding reported by Coverity
(UNINIT_CTOR).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:23 -04:00
Robin Getz 3dffef0427 fcdproplusthread: Initialize FCDProPlusThread sample buffer
Zero-initialize the FCDProPlusThread sample buffer to eliminate the cppcheck
UNINIT_CTOR warning. This ensures the sample buffer starts in a defined state
and avoids undefined behavior from reading uninitialized samples.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:02 -04:00
Robin Getz 7ec1b06a01 fcdprothread: Initialize FCDProThread sample buffer
Zero-initialize the FCDProThread sample buffer to eliminate the cppcheck
UNINIT_CTOR warning. This ensures the sample buffer starts in a defined state
and avoids undefined behavior from reading uninitialized samples.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:02 -04:00
Robin Getz 7fb4756ee1 audioinputworker: Initialize AudioInputWorker state
Initialize the previously uninitialized frequency position and audio sample
buffer members to defined values to eliminate cppcheck UNINIT_CTOR warnings.
This ensures the worker starts with a known state and avoids undefined behavior
from reading uninitialized values.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:23:02 -04:00
Robin Getz 3482989361 remotetcpinputgui: Initialize RemoteTCPInput device gains
Initialize the AGC and bias tee state to false to eliminate cppcheck
UNINIT_CTOR warnings and ensure DeviceGains starts in a defined state.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-13 20:22:56 -04:00
Jon Beniston a0918b5785 Map API names to setting names.
Fix API settings with spelling mistakes.
2026-09-13 12:09:20 +01:00
Jon BenistonandClaude Opus 5 d7bc4a94e4 TestSource: period and duty cycle for the P1 and P2 patterns
The sawtooth and square patterns had a fixed 1000 sample pulse width. Both
now take a period, and the square pattern a duty cycle, from the GUI, a
preset or the web API, with the period shown in seconds beside the sample
count.

A period of zero divides by zero in the sawtooth and wraps the unsigned
sample counter in the square pattern, giving a cycle of four billion
samples, so it is refused at every entrance: a minimum of one on the spin
box, a clamp when an older or hand edited preset is read, a clamp on the
web API, and a clamp in the worker for anything that reaches it another
way. The duty cycle is held to 0 to 100 the same way.

Also fixes the worker's timer. It is now parented to the worker so that it
moves to the worker thread with it, and it runs between startWork and
stopWork rather than from construction. TestSourceInput::stop() runs in
another thread, and Qt will not stop a timer from one, so the stop is
asked of the worker and waited for. The m_running flag it replaces is
gone, along with the test of it in every tick.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 19:42:07 +01:00
Jon BenistonandClaude Opus 5 7261593d03 Web API: settings that were declared but never read or written
A number of settings keys existed in the spec and in the SWG classes but
were missing from the plugin's webapi handlers, so setting them over the
API silently did nothing: dnrScheme on the SSB demodulator, aprsData on
the M17 modulator, pulseShaping on the packet, PSK31 and RTTY modulators,
audioDeviceName on Simple PTT, period, autosave, autoload, autosavePeriod
and filename on SID, and several on Star Tracker, XTRX and the Android SDR
driver input.

Three more were spelled so that they could never match. The channel
analyzer tested for "rationalDownSample " with a trailing space, radio
astronomy tested for "sweep12Start" and "sweep12Stop" rather than
"sweep2Start" and "sweep2Stop", and AFC read "hasTargetFrequency" into
m_transverterTarget rather than "transverterTarget". The channel analyzer
also now accepts the shorter "frequency", "downSample" and
"downSamplerRate" spellings alongside the existing ones.

MapSettings::applySettings ignored rgbColor and mapType, so a patch
carrying them was accepted and then dropped.

Registers MCPServer.yaml in the web API resources so it is served with the
rest of the documentation, and drops a redundant nested guard in the Sky
Map report left by the QString leak fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 19:28:50 +01:00
Jon BenistonandClaude Opus 5 ddedd59568 Add MessageDialog and use it in place of the QMessageBox static functions
QMessageBox::information() and friends build the box on the stack, parent
it to the calling widget and run a nested event loop in exec(). If the
parent is closed while the box is open, which the Web API can do at any
time, the parent deletes the box and its children and the heap is
corrupted.

MessageDialog offers the same calls, but the box is heap allocated, given
Qt::WA_DeleteOnClose and shown rather than exec'd, so nothing runs a
nested event loop and the box owns its own lifetime. A box with the same
text as one already up is raised instead of a second being created.

The trade off is that information(), warning() and critical() return
immediately and cannot report which button was pressed. question() takes
a callback for the cases that need the answer.

Converts the call sites in the device, channel and feature GUIs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 17:16:49 +01:00
Jon BenistonandClaude Opus 5 60db861797 Fix QString leak in the web API settings and report formatters
The generated SWG setters overwrite the string pointer without deleting
what is already there, and every webapiSettingsGet and webapiReportGet
calls init() first, which has allocated one. Each call therefore leaked a
QString per string field. Measured at 117 bytes per settings GET for the
Satellite Tracker, over 20,000 requests.

Assign in place when the pointer is already set, which is what these same
functions have always done for title and reverseAPIAddress. 394 sites
across webapiFormatChannelSettings, webapiFormatDeviceSettings,
webapiFormatFeatureSettings and the three report equivalents.

The webapiReverseSend* functions are deliberately left alone: they build a
fresh SWG object whose constructor leaves the pointers null, so passing a
new QString is correct there.

After the change the same measurement is flat, at 7 bytes per GET.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 16:54:42 +01:00
Edouard Griffiths 866ef1656a Merge pull request #2916 from srcejon/fix_2908
USRP: Support devices without GPIO, such as n210.
2026-09-09 12:55:53 +02:00
Jon Beniston d2514292dd USRP: Support devices without GPIO, such as n210. 2026-09-07 13:23:45 +01:00
Robin Getz 1b20e538d3 plutoSDR: Make thread running state atomic
m_running is used to synchronize the PlutoSDR manager and runner
threads. The manager-side startWork() and stopWork() functions control
whether the runner in run() should execute.

startWork() reads m_running before starting the QThread and then waits
for run() to set it true. stopWork() sets m_running false to request
that the runner exit, while run() continuously reads the flag and sets
it false when it terminates.

These accesses occur across the manager and runner threads without
atomic synchronization. Make m_running an atomic_bool in the PlutoSDR
input, output, MIMO input, and MIMO output threads to eliminate the data
race identified by ThreadSanitizer.

This can prevent inconsistent thread state during user-driven device
start, stop, and reload operations, where the GUI can cause the manager
thread to start or stop a PlutoSDR runner while that runner is
processing.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-06 23:53:53 -04:00
Robin Getz 893b4ee044 PlutoSDR : Handle PlutoSDR device errors in the GUI
Update the PlutoSDR input, output, and MIMO GUIs to properly handle the
SDRangel device engine entering the StError state following an
asynchronous device failure.

Clear the affected start/stop controls without emitting their signals,
preventing the GUI from attempting to restart or otherwise operate on a
device that has become unavailable. Indicate the error state visually
and display the error message reported by the device engine.

Stop updating device-specific status information while the device engine
is in the error state, since the underlying PlutoSDR device and streaming
resources may already have been closed.

This keeps the GUI state synchronized with the SDRangel device engine
after asynchronous failures such as a disconnected or unavailable
PlutoSDR.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-04 19:48:50 -04:00
Robin Getz 0ec8363c43 PlutoSDR : Handle asynchronous PlutoSDR device errors
Handle asynchronous errors reported by the PlutoSDR streaming threads and
transition the affected SDRangel device to a stopped and closed state.

When a PlutoSDR acquisition or generation thread reports an error, stop
and destroy the affected streaming threads and release the associated
buffers and device resources. For MIMO devices, shut down both acquisition
and generation paths and close the associated RX and TX resources so the
device is left in a consistent state.

Propagate the failure to the SDRangel device engine using the
DSPAcquisitionError and DSPGenerationError messages, including the
underlying error code and a message indicating that the PlutoSDR needs
to be restarted.

Also guard PlutoSDRInput::start() against an unavailable device parameter
object. This can occur after an asynchronous device failure has already
closed the device and prevents a subsequent start operation from
dereferencing an invalid device state.

This ensures that asynchronous failures such as a disconnected PlutoSDR
or an unrecoverable acquisition or generation error do not leave the
SDRangel device engine running against an unavailable device.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-04 19:39:16 -04:00
Robin Getz 9b10827cb4 PlutoSDR: Report PlutoSDR streaming errors from worker threads
Detect negative return values from rxBufferRefill() and txBufferPush() in
the PlutoSDR input, output, and MIMO worker threads. These calls can fail
asynchronously after the device has successfully started, for example
when the PlutoSDR is disconnected or the underlying I/O connection
encounters an error.

Log the underlying error and emit the error code from the affected worker
thread instead of treating the negative return value as an ordinary
short or incomplete buffer.

This allows asynchronous PlutoSDR acquisition and generation failures to
be propagated out of the worker threads and handled by the device and DSP
error-handling infrastructure, rather than allowing the streaming thread
to continue operating with an invalid device state.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-04 19:36:56 -04:00
Robin Getz 8fda50c215 PlutoSDR : Fix PlutoSDR input thread memory leak
AddressSanitizer (ASAN) reports a memory leak from the buffer conversion
memory allocated by PlutoSDRInputThread. The memory was not released when
the thread was destroyed, causing the allocation to persist after the
device was closed.

Delete the conversion buffer in the thread destructor so the allocation is
properly released and the leak reported by ASAN is eliminated.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-09-04 19:28:02 -04:00
f4exb 97e9e21fe9 Release v7.27.2 2026-08-19 20:28:39 +02:00
Edouard Griffiths c861ae06a3 Merge pull request #2869 from rgetz/rgetz-fix-containerOutOfBounds
Fix cppcheck-reported out-of-bounds accesses
2026-08-10 11:42:16 +02:00
Robin Getz d4f36753ed remotetcpinput: Avoid using uninitialized converter buffer
Coverity reported that an invalid sample size could leave the
conversion buffer uninitialized before it was passed to calcPower()
and the sample FIFO.

Return early when the sample conversion format is unsupported to
prevent processing invalid data.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:50 -04:00
Robin Getz c170e03ddd rtl-sdr: Fix out-of-bounds tuner name lookup
Validate the tuner type index before accessing the tuner name table.
The previous check allowed an index equal to names.size(), which could
result in an out-of-range QStringList access.

Use a local integer value for the enum conversion and ensure only valid
indices are used when looking up tuner names.

pointed out by cppcheck: Access out of bounds

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:52:09 -04:00
Robin Getz edc4693448 rtl-sdr: Fix out-of-bounds access in gain selection
The gain change handler allowed an index equal to m_gains.size(),
which is outside the valid vector range. Reject invalid indices before
accessing the gain table to avoid undefined behavior.

found with cppcheck: Access out of bounds

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:40:15 -04:00
Robin Getz e46f204796 PlutoSDR: keep device open state consistent after close
Clear the m_open flag when closing PlutoSDR input and output
devices. Previously closeDevice() released m_deviceParams but left
m_open set, leaving the object in an inconsistent state where code
could treat a closed device as still valid.

This was exposed when reloading a running PlutoSDR device, where GUI
updates could access the partially torn-down device state.

Hopefully fixes #2833 (I don't have a windows machine to test).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-23 21:31:43 -04:00
Edouard Griffiths fcb7dbf8ba Merge pull request #2814 from rgetz/rgetz-pluto-gain-updates
plutosdr: Update RX gain limits dynamically from hardware
2026-07-21 03:13:47 +02:00
Edouard Griffiths f3c1d648ee Merge pull request #2812 from rgetz/rgetz-fix-2779
PlutoSDR: Guard against null buddy shared pointers | Fix #2779
2026-07-20 05:21:49 +02:00
Robin Getz 72d612d986 plutosdr: Update RX gain limits dynamically from hardware
Query the PlutoSDR hardware for the current RX gain range and use it
to configure the GUI gain control dynamically.

The AD936x gain limits vary with LO frequency. Previously the GUI used
a fixed gain range, allowing users to select values that the hardware
would reject after changing bands. The gain slider now refreshes its
minimum, maximum, and step size whenever the device center frequency is
updated.

Also change the gain setting serialization to use a signed integer so
negative gain values are preserved for operating modes that support
them.

Changes include:
- Add DevicePlutoSDRBox::getGainRange() to read
  in_voltage0_hardwaregain_available.
- Expose gain range through PlutoSDRInput.
- Refresh GUI gain limits when the device frequency changes.
- Avoid unnecessary widget updates when limits are unchanged.
- Store/restore gain as a signed value.
- Add default RX gain limit constants for fallback when the device
  cannot provide its range.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-19 17:48:53 -04:00
Robin Getz af4c366cb7 PlutoSDR: Guard against null buddy shared pointers | Fix #2779
Add defensive null checks before dereferencing DeviceAPI::getBuddySharedPtr()
in the PlutoSDR input and output plugins.

DeviceAPI initializes the buddy shared pointer to nullptr, so a buddy may
exist before its shared state has been attached. This could result in null
pointer dereferences during device initialization, buddy thread
suspend/resume, or settings application.

Changes include:
- Validate buddy shared pointer in openDevice() and fail gracefully if absent.
- Guard suspendBuddies() and resumeBuddies() against null shared pointers.
- Skip buddies without shared state during applySettings() while logging a
  warning.
- Prevent dereferencing null buddy shared pointers when restarting buddy
  threads.

These changes improve robustness during PlutoSDR buddy initialization and
avoid crashes caused by partially initialized buddy relationships.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-19 12:59:17 -04:00
Jon Beniston 97cabdeb71 getAaroniaRtsaReport rather than airspy. 2026-07-19 16:35:58 +01:00
f4exb 0bb7a1e600 Release v7.27.0 2026-07-04 09:55:26 +02:00
Alex Antonov UT2UM a15d66f147 Make Linux Fobos SDR runtimes optional at build time 2026-06-08 23:08:34 +03:00
Alex Antonov UT2UM 3f85144bed Enable native Fobos SDR source plugin on Linux 2026-06-05 07:47:56 +03:00
f4exb 7e37ca68a2 Release v7.26.0 2026-06-02 21:37:05 +02:00
Alex Antonov UT2UM 76f5042769 Add Fobos SDR dual backend sample source plugin 2026-05-27 18:58:28 +03:00
f4exb ef4357f26b Release 7.25.0 2026-05-04 06:00:17 +02:00
Tammo Jan Dijkema c86c178363 Use Qt6.2 compatible qt_add_plugin in CMake 2026-04-25 17:11:41 +02:00
f4exb 0e13bbab85 Release 7.24.0 2026-03-28 19:22:50 +01:00
Jon Beniston 78a1d8abf9 LimeSDR: Include "dsp/replaybuffer.h". Fixes #2678 2026-03-26 21:01:25 +00:00
Alejandro Aleman 40ea5d096f meshtastic: consolidate LoRa/Meshtastic demod, auto-profile, decode tree, and dechirp replay improvements 2026-03-12 13:04:04 +01:00
f4exb 5ae74e9e19 Release 7.23.2 2026-02-14 10:58:43 +01:00
f4exb fcbaf95403 Fixed settings keys 2026-02-12 23:23:27 +01:00