diff --git a/.gitignore b/.gitignore index 46f1980..9821b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ missing *.pyc .md5sums RTL2832U +*.swp diff --git a/RTL2832U.prf.xml b/RTL2832U.prf.xml index 3218eae..7143842 100644 --- a/RTL2832U.prf.xml +++ b/RTL2832U.prf.xml @@ -228,6 +228,12 @@ False: Does not need control and can just attach to any currently tasked device + + Since RTL v3, a bias tee is included to drive 3.3V out the antenna port to power active LNAs/antennas. + False + + + Frontend Interfaces scanner allocation structure @@ -237,4 +243,4 @@ False: Does not need control and can just attach to any currently tasked device - \ No newline at end of file + diff --git a/cpp/RTL2832U.cpp b/cpp/RTL2832U.cpp index 7881663..69e7fa5 100644 --- a/cpp/RTL2832U.cpp +++ b/cpp/RTL2832U.cpp @@ -306,14 +306,6 @@ int RTL2832U_i::serviceFunction() return NOOP; } -/* acquires the prop_lock and the rtl_tuner.lock */ -//void RTL2832U_i::initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException) -//{ -// RTL2832U_base::initialize(); -// -// -//} - void RTL2832U_i::construct() { /*********************************************************************************** @@ -326,6 +318,7 @@ void RTL2832U_i::construct() // set some default values that should get overwritten by correct values group_id = "RTL_GROUP_ID_NOT_SET"; digital_agc_enable = false; + bias_enable = false; //target_device.index = -1; @@ -339,14 +332,23 @@ void RTL2832U_i::construct() this function is invoked in the constructor ***********************************************************************************/ - addPropertyChangeListener("target_device", this, &RTL2832U_i::targetDeviceChanged); - addPropertyChangeListener("group_id", this, &RTL2832U_i::groupIdChanged); - addPropertyChangeListener("digital_agc_enable", this, &RTL2832U_i::rtl2832uAgcEnableChanged); - addPropertyChangeListener("update_available_devices", this, &RTL2832U_i::updateAvailableDevicesChanged); - addPropertyChangeListener("frequency_correction", this, &RTL2832U_i::frequencyCorrectionChanged); - + addPropertyListener(target_device, this, &RTL2832U_i::targetDeviceChanged); + addPropertyListener(group_id, this, &RTL2832U_i::groupIdChanged); + addPropertyListener(digital_agc_enable, this, &RTL2832U_i::rtl2832uAgcEnableChanged); + addPropertyListener(update_available_devices, this, &RTL2832U_i::updateAvailableDevicesChanged); + addPropertyListener(frequency_correction, this, &RTL2832U_i::frequencyCorrectionChanged); + addPropertyListener(bias_enable, this, &RTL2832U_i::biasEnableChanged); +} - LOG_INFO(RTL2832U_i, "Target Device Index " << target_device.index) +/* Developer Note: Property overrides from DCD are applied AFTER the constructor and do not trigger + * property change listeners(?). In order for property overrides from DCD to be properly applied, + * initialize the rtl device inside the 'initialize' method. */ +/* acquires the prop_lock and the rtl_tuner.lock */ +void RTL2832U_i::initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException) +{ + RTL2832U_base::initialize(); + + LOG_INFO(RTL2832U_i, "Target Device Index " << target_device.index) { // scope for prop_lock exclusive_lock lock(prop_lock); @@ -1108,6 +1110,14 @@ void RTL2832U_i::frequencyCorrectionChanged(const short* old_value, const short* } } +/* acquires the rtl_tuner.lock */ +void RTL2832U_i::biasEnableChanged(const bool* old_value, const bool* new_value){ + LOG_TRACE(RTL2832U_i,__PRETTY_FUNCTION__); + if(rtl_device_ptr != NULL) + scoped_tuner_lock tuner_lock(rtl_tuner.lock); + rtl_device_ptr->setBiasMode(*new_value); +} + /************************************************************* Helper functions *************************************************************/ @@ -1166,7 +1176,7 @@ void RTL2832U_i::initRtl() throw (CF::PropertySet::InvalidConfiguration) { current_device.vendor.clear(); current_device.serial.clear(); rtl_tuner.reset(); - digital_agc_enable = false; + //digital_agc_enable = false; // update available devices updateAvailableDevices(); @@ -1257,6 +1267,9 @@ void RTL2832U_i::initRtl() throw (CF::PropertySet::InvalidConfiguration) { // set RTL2832 AGC mode according to property value rtl_device_ptr->setAgcMode(digital_agc_enable); + + // set bias mode according to property value + rtl_device_ptr->setBiasMode(bias_enable); // start with tuner gain mode set to auto rtl_device_ptr->setGainMode(true); diff --git a/cpp/RTL2832U.h b/cpp/RTL2832U.h index b80494a..b7c9c74 100644 --- a/cpp/RTL2832U.h +++ b/cpp/RTL2832U.h @@ -147,7 +147,7 @@ class RTL2832U_i : public RTL2832U_base int serviceFunction(); /* acquires the prop_lock and the rtl_tuner.lock */ - // void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException); + void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException); protected: @@ -285,6 +285,9 @@ class RTL2832U_i : public RTL2832U_base /* acquires the prop_lock and the rtl_tuner.lock */ void frequencyCorrectionChanged(const short* old_value, const short* new_value); + + /* acquires the rtl_tuner.lock */ + void biasEnableChanged(const bool* old_value, const bool* new_value); // // helper functions diff --git a/cpp/RTL2832U_base.cpp b/cpp/RTL2832U_base.cpp index 4c05f0c..a751772 100644 --- a/cpp/RTL2832U_base.cpp +++ b/cpp/RTL2832U_base.cpp @@ -153,6 +153,15 @@ void RTL2832U_base::loadProperties() "ppm", "external", "property"); + + addProperty(bias_enable, + false, + "bias_enable", + "bias_enable", + "readwrite", + "", + "external", + "property"); frontend_listener_allocation = frontend::frontend_listener_allocation_struct(); frontend_tuner_allocation = frontend::frontend_tuner_allocation_struct(); diff --git a/cpp/RTL2832U_base.h b/cpp/RTL2832U_base.h index 52cc2f6..84985ea 100644 --- a/cpp/RTL2832U_base.h +++ b/cpp/RTL2832U_base.h @@ -44,6 +44,8 @@ class RTL2832U_base : public frontend::FrontendScanningTunerDevice= 2.1.3 omniORB4 >= 4.1.0]) PKG_CHECK_MODULES([INTERFACEDEPS], [frontend >= 2.3, bulkio >= 2.1]) -PKG_CHECK_MODULES([LIBRTLSDR], [librtlsdr = 0.5.2 libusb-1.0 >= 1.0.0 ]) +PKG_CHECK_MODULES([LIBRTLSDR], [librtlsdr >= 0.5.4 libusb-1.0 >= 1.0.0 ], [HAS_RTLSDR_BIASTEE=1], [HAS_RTLSDR_BIASTEE=0]) +AS_IF([test "$HAS_RTLSDR_BIASTEE" -eq 1], + [AC_DEFINE(HAS_RTLSDR_BIASTEE)], + [PKG_CHECK_MODULES([LIBRTLSDR], [librtlsdr >= 0.5.3 libusb-1.0 >= 1.0.0 ])]) +AC_MSG_CHECKING(for LIBRTLSDR BIASTEE SUPPORT) +AC_MSG_RESULT($HAS_RTLSDR_BIASTEE) PKG_CHECK_MODULES([LIBUUID], [uuid]) OSSIE_ENABLE_LOG4CXX AX_BOOST_BASE([1.41]) diff --git a/rh.RTL2832U.spec b/rh.RTL2832U.spec index a8f539b..ddd62ff 100644 --- a/rh.RTL2832U.spec +++ b/rh.RTL2832U.spec @@ -32,7 +32,7 @@ Prefix: %{_prefix} Name: rh.RTL2832U Version: 2.1.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Device %{name} Group: REDHAWK/Devices @@ -49,9 +49,8 @@ Requires: frontendInterfaces >= 2.3 bulkioInterfaces >= 2.1 # RTL requirements BuildRequires: libusb1-devel >= 1.0.0 -BuildRequires: librtlsdr >= 0.5.2 -Requires: librtlsdr >= 0.5.2 - +BuildRequires: rtl-sdr-devel >= 0.5.3 +Requires: rtl-sdr >= 0.5.3 Obsoletes: RTL2832U < 2.0.0