From e315a41ec5814523caaa3d4ac8f4fb775f1e96e6 Mon Sep 17 00:00:00 2001 From: hayati ayguen Date: Fri, 21 Aug 2020 13:29:10 -0700 Subject: [PATCH] bugfix, 3rd try: avoid printing "PLL not locked" * bugfix wrong return value in r82xx_set_pll(), when "PLL not locked" was printed. removed all similar messages - regarded as noise, e.g. when running rtl_test -t * suppress output of tuning band 0 - 0 Hz in rtl_test Signed-off-by: hayati ayguen --- src/rtl_test.c | 6 ++++-- src/tuner_r82xx.c | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/rtl_test.c b/src/rtl_test.c index d80b955..ee85284 100644 --- a/src/rtl_test.c +++ b/src/rtl_test.c @@ -280,11 +280,13 @@ static uint32_t min_step(uint32_t freq) { } static void report_band_start(uint32_t start) { - fprintf(stderr, "Found a new band starting at %u Hz\n", start); + if (start) + fprintf(stderr, "Found a new band starting at %u Hz\n", start); } static void report_band(uint32_t low, uint32_t high) { - fprintf(stderr, "Tuning band: %u - %u Hz\n", low, high); + if ( low != high && low ) + fprintf(stderr, "Tuning band: %u - %u Hz\n\n", low, high); } void tuner_benchmark(void) diff --git a/src/tuner_r82xx.c b/src/tuner_r82xx.c index 250fee8..984e48c 100644 --- a/src/tuner_r82xx.c +++ b/src/tuner_r82xx.c @@ -31,6 +31,7 @@ #include "tuner_r82xx.h" #define WITH_ASYM_FILTER 0 +#define PRINT_PLL_ERRORS 0 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -802,7 +803,9 @@ static int r82xx_set_pll(struct r82xx_priv *priv, uint32_t freq) #endif if (nint > ((128 / vco_power_ref) - 1)) { +#if PRINT_PLL_ERRORS fprintf(stderr, "[R82XX] No valid PLL values for %u Hz!\n", freq); +#endif return -1; } @@ -848,10 +851,12 @@ static int r82xx_set_pll(struct r82xx_priv *priv, uint32_t freq) } if (!(data[2] & 0x40)) { +#if PRINT_PLL_ERRORS fprintf(stderr, "[R82XX] PLL not locked at Tuner LO %u Hz for RF %u Hz!\n", freq, priv->rf_freq); +#endif priv->has_lock = 0; - return 0; + return -1; } #if 0 else @@ -1605,8 +1610,10 @@ int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq) } err: +#if PRINT_PLL_ERRORS if (rc < 0) fprintf(stderr, "%s: failed=%d\n", __FUNCTION__, rc); +#endif return rc; }