From ff6615e08fbe7cc1e392f9172c31ddf2f54fe97d Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Wed, 1 Aug 2012 22:21:00 +0200 Subject: [PATCH] rtl: explicitly set agc mode (off by default) --- lib/rtl/rtl_source_c.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc index 18db321..8839a2f 100644 --- a/lib/rtl/rtl_source_c.cc +++ b/lib/rtl/rtl_source_c.cc @@ -152,7 +152,11 @@ rtl_source_c::rtl_source_c (const std::string &args) ret = rtlsdr_set_tuner_gain_mode(_dev, int(!_auto_gain)); if (ret < 0) - throw std::runtime_error("Failed to enable manual gain mode."); + throw std::runtime_error("Failed to set tuner gain mode."); + + ret = rtlsdr_set_agc_mode(_dev, int(_auto_gain)); + if (ret < 0) + throw std::runtime_error("Failed to set agc mode."); ret = rtlsdr_reset_buffer( _dev ); if (ret < 0) @@ -430,6 +434,8 @@ bool rtl_source_c::set_gain_mode( bool automatic, size_t chan ) if (!rtlsdr_set_tuner_gain_mode(_dev, int(!automatic))) { _auto_gain = automatic; } + + rtlsdr_set_agc_mode(_dev, int(automatic)); } return get_gain_mode(chan);