From b25e988c1855cd3049611338342d4de5ae18f0a3 Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Fri, 11 Aug 2023 14:56:07 +0200 Subject: [PATCH] plugins: spectrum_analyser: Fix sampling freq check When trying to start the spectrum analyzer from the plugin, any mismatch between the requested sampling rate and the set rate read back causes the plugin to fail to launch due to a `return false`. On many systems, there is a small mismatch where `61440000` (default rate) will return `61439999`, causing a match failures. This change simply logs the mistmatch warning, but still allows the output window to be shown. Signed-off-by: Kevin Townsend --- plugins/spectrum_analyzer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/spectrum_analyzer.c b/plugins/spectrum_analyzer.c index 27b7ddddf..5ef93a58b 100644 --- a/plugins/spectrum_analyzer.c +++ b/plugins/spectrum_analyzer.c @@ -389,9 +389,8 @@ static bool configure_data_capture(plugin_setup *setup) device_set_rx_sampling_freq(dev, sampling_rate); rate = device_get_rx_sampling_freq(cap); if (rate != sampling_rate) { - fprintf(stderr, "Failed to set the rx sampling rate to %lld" - "in %s\n", sampling_rate, __func__); - return false; + fprintf(stderr, "Failed to set the rx sampling rate to %lld " + "(actual rate is %lld) in %s\n", sampling_rate, rate, __func__); } dev_info = iio_device_get_data(cap);