aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rtl/rtl_source_c.cc
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2012-10-10 21:03:48 +0200
committerSteve Markgraf <steve@steve-m.de>2012-10-10 21:03:48 +0200
commit8c3786336f6aa62d23095a047215df149f838c10 (patch)
tree4c54a929809786c5f85a365e64079bf74572e599 /lib/rtl/rtl_source_c.cc
parentdee9d3e696cf8bc93cd3510008eab81f88bd6d5d (diff)
rtl: add offset tuning as device parameter
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'lib/rtl/rtl_source_c.cc')
-rw-r--r--lib/rtl/rtl_source_c.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc
index cc40fe9..803364c 100644
--- a/lib/rtl/rtl_source_c.cc
+++ b/lib/rtl/rtl_source_c.cc
@@ -89,6 +89,7 @@ rtl_source_c::rtl_source_c (const std::string &args)
{
int ret;
unsigned int dev_index = 0, rtl_freq = 0, tuner_freq = 0, direct_samp = 0;
+ unsigned int offset_tune = 0;
dict_t dict = params_to_dict(args);
@@ -104,6 +105,9 @@ rtl_source_c::rtl_source_c (const std::string &args)
if (dict.count("direct_samp"))
direct_samp = boost::lexical_cast< unsigned int >( dict["direct_samp"] );
+ if (dict.count("offset_tune"))
+ offset_tune = boost::lexical_cast< unsigned int >( dict["offset_tune"] );
+
_buf_num = BUF_NUM;
_buf_head = _buf_used = _buf_offset = 0;
_samp_avail = BUF_SIZE / BYTES_PER_SAMPLE;
@@ -169,6 +173,12 @@ rtl_source_c::rtl_source_c (const std::string &args)
throw std::runtime_error("Failed to enable direct sampling mode.");
}
+ if (offset_tune) {
+ ret = rtlsdr_set_offset_tuning(_dev, offset_tune);
+ if (ret < 0)
+ throw std::runtime_error("Failed to enable offset tuning.");
+ }
+
ret = rtlsdr_reset_buffer( _dev );
if (ret < 0)
throw std::runtime_error("Failed to reset usb buffers.");