diff --git a/src/urh/dev/config.py b/src/urh/dev/config.py index e72ca680f..753313295 100644 --- a/src/urh/dev/config.py +++ b/src/urh/dev/config.py @@ -99,7 +99,8 @@ "bandwidth": dev_range(start=1, stop=int(3.2 * M), step=1), "rx_rf_gain": list(range(-100, 500)), "direct_sampling": ["disabled", "I-ADC input enabled", "Q-ADC input enabled"], - "freq_correction": dev_range(start=-1 * 10 ** 3, stop=1 * 10 ** 3, step=1) + "freq_correction": dev_range(start=-1 * 10 ** 3, stop=1 * 10 ** 3, step=1), + "bias_tee_enabled": [False, True] } DEVICE_CONFIG["RTL-TCP"] = copy.deepcopy(DEVICE_CONFIG["RTL-SDR"]) diff --git a/src/urh/dev/native/RTLSDR.py b/src/urh/dev/native/RTLSDR.py index 3b5fcf23e..9aa0a496d 100644 --- a/src/urh/dev/native/RTLSDR.py +++ b/src/urh/dev/native/RTLSDR.py @@ -18,7 +18,8 @@ class RTLSDR(Device): Device.Command.SET_RF_GAIN.name+"_get_allowed_values": "get_tuner_gains", Device.Command.SET_BANDWIDTH.name: "set_tuner_bandwidth", Device.Command.SET_FREQUENCY_CORRECTION.name: "set_freq_correction", - Device.Command.SET_DIRECT_SAMPLING_MODE.name: "set_direct_sampling" + Device.Command.SET_DIRECT_SAMPLING_MODE.name: "set_direct_sampling", + Device.Command.SET_BIAS_TEE_ENABLED.name: "set_bias_tee" }) DATA_TYPE = np.int8 @@ -77,6 +78,7 @@ def device_parameters(self): (self.Command.SET_FREQUENCY_CORRECTION.name, self.freq_correction), (self.Command.SET_DIRECT_SAMPLING_MODE.name, self.direct_sampling_mode), (self.Command.SET_RF_GAIN.name, self.gain), + (self.Command.SET_BIAS_TEE_ENABLED.name, self.bias_tee_enabled), ("identifier", self.device_number)]) @property diff --git a/src/urh/dev/native/lib/crtlsdr.pxd b/src/urh/dev/native/lib/crtlsdr.pxd index 415fa6a41..6415d3ff3 100644 --- a/src/urh/dev/native/lib/crtlsdr.pxd +++ b/src/urh/dev/native/lib/crtlsdr.pxd @@ -69,3 +69,5 @@ cdef extern from "rtl-sdr.h": int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx, uint32_t buf_num, uint32_t buf_len); int rtlsdr_cancel_async(rtlsdr_dev_t *dev) + + int rtlsdr_set_bias_tee(rtlsdr_dev_t *dev, int on) \ No newline at end of file diff --git a/src/urh/dev/native/lib/rtlsdr.pyx b/src/urh/dev/native/lib/rtlsdr.pyx index b37cf77e9..c1ea1ad46 100644 --- a/src/urh/dev/native/lib/rtlsdr.pyx +++ b/src/urh/dev/native/lib/rtlsdr.pyx @@ -332,3 +332,11 @@ cpdef int cancel_async(): :return: 0 on success """ return crtlsdr.rtlsdr_cancel_async(_c_device) + +cpdef int set_bias_tee(int on): + """ + Enable or disable the bias tee on GPIO PIN 0. + + return -1 if device is not initialized. 0 otherwise. + """ + return crtlsdr.rtlsdr_set_bias_tee (_c_device, on) \ No newline at end of file