From 7407c6b3759ee082d9d1c0d1e2067632c96d670b Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Thu, 3 May 2018 16:47:50 +0200 Subject: [PATCH] Multi device support (#432) * control device extensions with macros remove fallback logic * wrap hackrf device list method * add multi device support for hackrf * fix argument order * add multi dev support for rtlsdr * add multi device support for lime sdr * add multi device support for sdrplay * multi device support for usrp --- data/ui/send_recv_device_settings.ui | 78 +- .../dialogs/ContinuousSendDialog.py | 3 +- .../controller/dialogs/ProtocolSniffDialog.py | 14 +- src/urh/controller/dialogs/ReceiveDialog.py | 12 +- src/urh/controller/dialogs/SendDialog.py | 6 +- src/urh/controller/dialogs/SendRecvDialog.py | 7 +- .../dialogs/SpectrumDialogController.py | 8 +- .../widgets/DeviceSettingsWidget.py | 40 +- src/urh/dev/BackendHandler.py | 5 +- src/urh/dev/VirtualDevice.py | 42 +- src/urh/dev/config.py | 1 - src/urh/dev/gr/AbstractBaseThread.py | 5 - src/urh/dev/native/Device.py | 25 +- src/urh/dev/native/ExtensionHelper.py | 71 +- src/urh/dev/native/HackRF.py | 20 +- src/urh/dev/native/LimeSDR.py | 30 +- src/urh/dev/native/RTLSDR.py | 21 +- src/urh/dev/native/SDRPlay.py | 32 +- src/urh/dev/native/USRP.py | 16 +- src/urh/dev/native/includes/config.h | 11 + .../dev/native/includes/libhackrf/hackrf.h | 100 +- src/urh/dev/native/lib/chackrf.pxd | 5 +- src/urh/dev/native/lib/crtlsdr.pxd | 3 + src/urh/dev/native/lib/cusrp.pxd | 2 + src/urh/dev/native/lib/hackrf.cpp | 1268 +-- src/urh/dev/native/lib/hackrf.pyx | 41 +- src/urh/dev/native/lib/rtlsdr.cpp | 1947 +++-- src/urh/dev/native/lib/rtlsdr.pyx | 32 +- src/urh/dev/native/lib/rtlsdr_fallback.cpp | 6893 ----------------- src/urh/dev/native/lib/rtlsdr_fallback.pyx | 313 - src/urh/dev/native/lib/usrp.c | 1056 ++- src/urh/dev/native/lib/usrp.pyx | 26 + src/urh/ui/ui_send_recv_device_settings.py | 43 +- tests/device/HackRFTests.py | 3 + tests/device/TestRTLSDR.py | 5 +- tests/device/TestRTLSDRPipe.py | 6 +- tests/device/TestUSRP.py | 2 + tests/test_simulator_dialog.py | 8 - 38 files changed, 3238 insertions(+), 8962 deletions(-) create mode 100644 src/urh/dev/native/includes/config.h delete mode 100644 src/urh/dev/native/lib/rtlsdr_fallback.cpp delete mode 100644 src/urh/dev/native/lib/rtlsdr_fallback.pyx diff --git a/data/ui/send_recv_device_settings.ui b/data/ui/send_recv_device_settings.ui index 5ce301eefb..1ead10606a 100644 --- a/data/ui/send_recv_device_settings.ui +++ b/data/ui/send_recv_device_settings.ui @@ -108,29 +108,6 @@ QGroupBox::indicator:checked { - - - - <html><head/><body><p>If you only have one USRP connected you may leave this field empty, so your USRP gets detected automatically.</p><p>If you have multiple USRPs connected or need better control, enter a device identifier of your USRP here.</p><p>You may also enter other device arguments here.</p></body></html> - - - -1 - - - - - - Device arguments: - - - - - - - <html><head/><body><p>If you only have one USRP connected you may leave this field empty, so your USRP gets detected automatically.</p><p>If you have multiple USRPs connected or need better control, enter a device identifier of your USRP here.</p><p>You may also enter other device arguments here.</p></body></html> - - - @@ -225,6 +202,13 @@ QGroupBox::indicator:checked { + + + + Bandwidth (Hz): + + + @@ -254,10 +238,13 @@ QGroupBox::indicator:checked { - - + + + + <html><head/><body><p>The gain (more exactly RF gain) is the gain applied to the RF signal. This amplifies the high frequent signal arriving at the antenna of your Software Defined Radio.</p></body></html> + - Bandwidth (Hz): + Gain: @@ -274,16 +261,6 @@ QGroupBox::indicator:checked { - - - - <html><head/><body><p>The gain (more exactly RF gain) is the gain applied to the RF signal. This amplifies the high frequent signal arriving at the antenna of your Software Defined Radio.</p></body></html> - - - Gain: - - - @@ -478,6 +455,34 @@ QGroupBox::indicator:checked { + + + + Device Identifier: + + + + + + + false + + + QComboBox::NoInsert + + + + + + + ... + + + + .. + + + @@ -496,7 +501,6 @@ QGroupBox::indicator:checked { groupBoxDeviceSettings cbDevice - lineEditDeviceArgs comboBoxChannel comboBoxAntenna lineEditIP diff --git a/src/urh/controller/dialogs/ContinuousSendDialog.py b/src/urh/controller/dialogs/ContinuousSendDialog.py index bdbfe50a06..326a574d2a 100644 --- a/src/urh/controller/dialogs/ContinuousSendDialog.py +++ b/src/urh/controller/dialogs/ContinuousSendDialog.py @@ -33,9 +33,8 @@ def __init__(self, project_manager, messages, modulators, total_samples: int, pa self.setWindowTitle("Send Signal (continuous mode)") self.ui.lSamplesSentText.setText("Progress:") - self.init_device() - self.create_connects() + self.device_settings_widget.on_cb_device_current_index_changed() def create_connects(self): SendRecvDialog.create_connects(self) diff --git a/src/urh/controller/dialogs/ProtocolSniffDialog.py b/src/urh/controller/dialogs/ProtocolSniffDialog.py index 0790db213b..9200e97ce2 100644 --- a/src/urh/controller/dialogs/ProtocolSniffDialog.py +++ b/src/urh/controller/dialogs/ProtocolSniffDialog.py @@ -32,21 +32,19 @@ def __init__(self, project_manager, signal=None, signals=None, parent=None, test self.sniff_settings_widget.ui.btn_sniff_use_signal.setAutoDefault(False) self.sniffer = self.sniff_settings_widget.sniffer + self.setWindowTitle(self.tr("Sniff Protocol")) + self.setWindowIcon(QIcon.fromTheme(":/icons/icons/sniffer.svg")) + + self.ui.txtEd_sniff_Preview.setFont(util.get_monospace_font()) # set really in on_device_started self.scene_manager = None # type: LiveSceneManager - self.init_device() - self.device_settings_widget.set_bandwidth_status() + self.create_connects() + self.device_settings_widget.on_cb_device_current_index_changed() - self.graphics_view.setScene(self.scene_manager.scene) - self.graphics_view.scene_manager = self.scene_manager - self.setWindowTitle(self.tr("Sniff Protocol")) - self.setWindowIcon(QIcon.fromTheme(":/icons/icons/sniffer.svg")) - self.ui.txtEd_sniff_Preview.setFont(util.get_monospace_font()) - self.create_connects() @property def view_type(self) -> int: diff --git a/src/urh/controller/dialogs/ReceiveDialog.py b/src/urh/controller/dialogs/ReceiveDialog.py index a2d8c2360e..a424d357a7 100644 --- a/src/urh/controller/dialogs/ReceiveDialog.py +++ b/src/urh/controller/dialogs/ReceiveDialog.py @@ -25,19 +25,13 @@ def __init__(self, project_manager, parent=None, testing_mode=False): self.already_saved = True self.recorded_files = [] - # set really in on_device_started - self.scene_manager = None # type: LiveSceneManager - - self.init_device() - self.device_settings_widget.set_bandwidth_status() - self.setWindowTitle("Record Signal") self.setWindowIcon(QIcon.fromTheme("media-record")) - self.graphics_view.setScene(self.scene_manager.scene) - self.graphics_view.scene_manager = self.scene_manager - + # set really in on_device_started + self.scene_manager = None # type: LiveSceneManager self.create_connects() + self.device_settings_widget.on_cb_device_current_index_changed() def create_connects(self): super().create_connects() diff --git a/src/urh/controller/dialogs/SendDialog.py b/src/urh/controller/dialogs/SendDialog.py index 2760e65cab..c9aab94907 100644 --- a/src/urh/controller/dialogs/SendDialog.py +++ b/src/urh/controller/dialogs/SendDialog.py @@ -48,12 +48,8 @@ def __init__(self, project_manager, modulated_data, modulation_msg_indices=None, self.graphics_view.set_signal(signal) self.graphics_view.sample_rate = samp_rate - self.init_device() - - self.graphics_view.setScene(self.scene_manager.scene) - self.graphics_view.scene_manager = self.scene_manager - self.create_connects() + self.device_settings_widget.on_cb_device_current_index_changed() def create_connects(self): super().create_connects() diff --git a/src/urh/controller/dialogs/SendRecvDialog.py b/src/urh/controller/dialogs/SendRecvDialog.py index 8f4fbcc09c..a671dfea39 100644 --- a/src/urh/controller/dialogs/SendRecvDialog.py +++ b/src/urh/controller/dialogs/SendRecvDialog.py @@ -140,7 +140,8 @@ def emit_editing_finished_signals(self): @pyqtSlot() def on_selected_device_changed(self): - self.scene_manager.plot_data = None + if hasattr(self.scene_manager, "plot_data"): + self.scene_manager.plot_data = None self.init_device() @@ -164,6 +165,8 @@ def on_device_stopped(self): self.ui.btnStop.setEnabled(False) self.ui.btnClear.setEnabled(True) self.ui.btnSave.setEnabled(self.device.current_index > 0) + self.device_settings_widget.ui.comboBoxDeviceIdentifier.setEnabled(True) + self.device_settings_widget.ui.btnRefreshDeviceIdentifier.setEnabled(True) self.device_settings_widget.set_bandwidth_status() self.timer.stop() @@ -179,6 +182,8 @@ def on_device_started(self): self.ui.btnClear.setEnabled(False) self.ui.btnStop.setEnabled(True) + self.device_settings_widget.ui.comboBoxDeviceIdentifier.setEnabled(False) + self.device_settings_widget.ui.btnRefreshDeviceIdentifier.setEnabled(False) self.timer.start(self.update_interval) diff --git a/src/urh/controller/dialogs/SpectrumDialogController.py b/src/urh/controller/dialogs/SpectrumDialogController.py index cc5f64c65d..4b5151f302 100644 --- a/src/urh/controller/dialogs/SpectrumDialogController.py +++ b/src/urh/controller/dialogs/SpectrumDialogController.py @@ -31,9 +31,6 @@ def __init__(self, project_manager, parent=None, testing_mode=False): self.ui.graphicsViewSpectrogram.setScene(QGraphicsScene()) self.__clear_spectrogram() - self.init_device() - self.device_settings_widget.set_bandwidth_status() - self.gain_timer = QTimer(self) self.gain_timer.setSingleShot(True) @@ -44,6 +41,7 @@ def __init__(self, project_manager, parent=None, testing_mode=False): self.bb_gain_timer.setSingleShot(True) self.create_connects() + self.device_settings_widget.on_cb_device_current_index_changed() def __clear_spectrogram(self): self.ui.graphicsViewSpectrogram.scene().clear() @@ -65,7 +63,6 @@ def __update_spectrogram(self): scene.setSceneRect(0, 0, Spectrogram.DEFAULT_FFT_WINDOW_SIZE, self.spectrogram_y_pos) self.ui.graphicsViewSpectrogram.ensureVisible(pixmap_item) - def _eliminate_graphic_view(self): super()._eliminate_graphic_view() if self.ui.graphicsViewSpectrogram and self.ui.graphicsViewSpectrogram.scene() is not None: @@ -81,7 +78,8 @@ def create_connects(self): self.graphics_view.wheel_event_triggered.connect(self.on_graphics_view_wheel_event_triggered) self.device_settings_widget.ui.sliderGain.valueChanged.connect(self.on_slider_gain_value_changed) - self.device_settings_widget.ui.sliderBasebandGain.valueChanged.connect(self.on_slider_baseband_gain_value_changed) + self.device_settings_widget.ui.sliderBasebandGain.valueChanged.connect( + self.on_slider_baseband_gain_value_changed) self.device_settings_widget.ui.sliderIFGain.valueChanged.connect(self.on_slider_if_gain_value_changed) self.device_settings_widget.ui.spinBoxFreq.editingFinished.connect(self.on_spinbox_frequency_editing_finished) diff --git a/src/urh/controller/widgets/DeviceSettingsWidget.py b/src/urh/controller/widgets/DeviceSettingsWidget.py index 73c61f268d..d86773c2ad 100644 --- a/src/urh/controller/widgets/DeviceSettingsWidget.py +++ b/src/urh/controller/widgets/DeviceSettingsWidget.py @@ -25,6 +25,8 @@ def __init__(self, project_manager: ProjectManager, is_tx: bool, backend_handler self.ui = Ui_FormDeviceSettings() self.ui.setupUi(self) + self.__device = None # type: VirtualDevice + self.is_tx = is_tx self.is_rx = not is_tx if backend_handler is None: @@ -42,8 +44,6 @@ def __init__(self, project_manager: ProjectManager, is_tx: bool, backend_handler self.ui.cbDevice.addItems(items) self.bootstrap(project_manager.device_conf, enforce_default=True) - self.__device = None # type: VirtualDevice - self.ui.btnLockBWSR.setChecked(self.bw_sr_are_locked) self.on_btn_lock_bw_sr_clicked() @@ -134,7 +134,6 @@ def create_connects(self): self.ui.spinBoxBandwidth.editingFinished.connect(self.on_spinbox_bandwidth_editing_finished) self.ui.spinBoxPort.editingFinished.connect(self.on_spinbox_port_editing_finished) self.ui.lineEditIP.editingFinished.connect(self.on_line_edit_ip_editing_finished) - self.ui.lineEditDeviceArgs.editingFinished.connect(self.on_line_edit_device_args_editing_finished) self.ui.comboBoxAntenna.currentIndexChanged.connect(self.on_combobox_antenna_current_index_changed) self.ui.comboBoxChannel.currentIndexChanged.connect(self.on_combobox_channel_current_index_changed) @@ -142,11 +141,15 @@ def create_connects(self): self.ui.spinBoxFreqCorrection.editingFinished.connect(self.on_spinbox_freq_correction_editing_finished) self.ui.comboBoxDirectSampling.currentIndexChanged.connect(self.on_combobox_direct_sampling_index_changed) - self.ui.cbDevice.currentIndexChanged.connect(self.cb_device_current_index_changed) + self.ui.cbDevice.currentIndexChanged.connect(self.on_cb_device_current_index_changed) self.ui.spinBoxNRepeat.editingFinished.connect(self.on_num_repeats_changed) self.ui.btnLockBWSR.clicked.connect(self.on_btn_lock_bw_sr_clicked) + self.ui.btnRefreshDeviceIdentifier.clicked.connect(self.on_btn_refresh_device_identifier_clicked) + self.ui.comboBoxDeviceIdentifier.currentIndexChanged.connect(self.on_combo_box_device_identifier_current_index_changed) + + def set_gain_defaults(self): self.set_default_rf_gain() self.set_default_if_gain() @@ -271,8 +274,10 @@ def set_device_ui_items_visibility(self, device_name: str, adjust_gains=True): else: combobox.setVisible(False) - self.ui.lineEditDeviceArgs.setVisible("device_args" in conf) - self.ui.labelDeviceArgs.setVisible("device_args" in conf) + multi_dev_support = hasattr(self.device, "has_multi_device_support") and self.device.has_multi_device_support + self.ui.labelDeviceIdentifier.setVisible(multi_dev_support) + self.ui.btnRefreshDeviceIdentifier.setVisible(multi_dev_support) + self.ui.comboBoxDeviceIdentifier.setVisible(multi_dev_support) self.ui.lineEditIP.setVisible("ip" in conf) self.ui.labelIP.setVisible("ip" in conf) self.ui.spinBoxPort.setVisible("port" in conf) @@ -320,7 +325,6 @@ def emit_editing_finished_signals(self): self.ui.spinBoxFreqCorrection.editingFinished.emit() self.ui.lineEditIP.editingFinished.emit() self.ui.spinBoxPort.editingFinished.emit() - self.ui.lineEditDeviceArgs.editingFinished.emit() self.ui.comboBoxAntenna.currentIndexChanged.emit(self.ui.comboBoxAntenna.currentIndex()) self.ui.comboBoxChannel.currentIndexChanged.emit(self.ui.comboBoxChannel.currentIndex()) @@ -372,10 +376,6 @@ def on_spinbox_bandwidth_editing_finished(self): def on_line_edit_ip_editing_finished(self): self.device.ip = self.ui.lineEditIP.text() - @pyqtSlot() - def on_line_edit_device_args_editing_finished(self): - self.device.device_args = self.ui.lineEditDeviceArgs.text() - @pyqtSlot() def on_spinbox_port_editing_finished(self): self.device.port = self.ui.spinBoxPort.value() @@ -452,9 +452,11 @@ def on_spinbox_baseband_gain_value_changed(self, value: int): pass @pyqtSlot() - def cb_device_current_index_changed(self): + def on_cb_device_current_index_changed(self): if self.device is not None: self.device.free_data() + + # Here init_device of dialogs gets called self.selected_device_changed.emit() dev_name = self.ui.cbDevice.currentText() @@ -463,6 +465,20 @@ def cb_device_current_index_changed(self): self.sync_gain_sliders() self.set_bandwidth_status() + self.ui.comboBoxDeviceIdentifier.clear() + + @pyqtSlot() + def on_btn_refresh_device_identifier_clicked(self): + if self.device is None: + return + self.ui.comboBoxDeviceIdentifier.clear() + self.ui.comboBoxDeviceIdentifier.addItems(self.device.get_device_list()) + + @pyqtSlot() + def on_combo_box_device_identifier_current_index_changed(self): + if self.device is not None: + self.device.device_serial = self.ui.comboBoxDeviceIdentifier.currentText() + self.device.device_number = self.ui.comboBoxDeviceIdentifier.currentIndex() if __name__ == '__main__': from PyQt5.QtWidgets import QApplication diff --git a/src/urh/dev/BackendHandler.py b/src/urh/dev/BackendHandler.py index f8df3f2b63..871e9bb454 100644 --- a/src/urh/dev/BackendHandler.py +++ b/src/urh/dev/BackendHandler.py @@ -157,10 +157,7 @@ def __lime_native_enabled(self) -> bool: @property def __rtlsdr_native_enabled(self) -> bool: try: - try: - from urh.dev.native.lib import rtlsdr - except ImportError: - from urh.dev.native.lib import rtlsdr_fallback + from urh.dev.native.lib import rtlsdr return True except ImportError: return False diff --git a/src/urh/dev/VirtualDevice.py b/src/urh/dev/VirtualDevice.py index 23fcdc98b8..5aebb4d499 100644 --- a/src/urh/dev/VirtualDevice.py +++ b/src/urh/dev/VirtualDevice.py @@ -150,6 +150,34 @@ def __init__(self, backend_handler, name: str, mode: Mode, freq=None, sample_rat if mode == Mode.spectrum: self.__dev.is_in_spectrum_mode = True + @property + def has_multi_device_support(self): + return hasattr(self.__dev, "has_multi_device_support") and self.__dev.has_multi_device_support + + @property + def device_serial(self): + if hasattr(self.__dev, "device_serial"): + return self.__dev.device_serial + else: + return None + + @device_serial.setter + def device_serial(self, value): + if hasattr(self.__dev, "device_serial"): + self.__dev.device_serial = value + + @property + def device_number(self): + if hasattr(self.__dev, "device_number"): + return self.__dev.device_number + else: + return None + + @device_number.setter + def device_number(self, value): + if hasattr(self.__dev, "device_number"): + self.__dev.device_number = value + @property def bandwidth(self): return self.__dev.bandwidth @@ -353,14 +381,6 @@ def samples_to_send(self, value): else: raise ValueError("Unsupported Backend") - @property - def device_args(self): - return self.__dev.device_args - - @device_args.setter - def device_args(self, value): - self.__dev.device_args = value - @property def ip(self): if self.backend == Backends.grc: @@ -656,6 +676,12 @@ def set_client_port(self, port: int): else: raise ValueError("Setting port only supported for NetworkSDR Plugin") + def get_device_list(self): + if hasattr(self.__dev, "get_device_list"): + return self.__dev.get_device_list() + else: + return [] + def increase_gr_port(self): if self.backend == Backends.grc: self.__dev.gr_port += 1 diff --git a/src/urh/dev/config.py b/src/urh/dev/config.py index 933ca5edd5..eacfa6788a 100644 --- a/src/urh/dev/config.py +++ b/src/urh/dev/config.py @@ -38,7 +38,6 @@ "center_freq": dev_range(start=0, stop=6 * G, step=1), "sample_rate": dev_range(start=1, stop=200 * M, step=1), "bandwidth": dev_range(start=1, stop=120 * M, step=1), - "device_args": "", "rx_rf_gain": list(range(0, 101)), "tx_rf_gain": list(range(0, 101)), "antenna": [0, 1] diff --git a/src/urh/dev/gr/AbstractBaseThread.py b/src/urh/dev/gr/AbstractBaseThread.py index 6e5cf1d8be..5eb318efcf 100644 --- a/src/urh/dev/gr/AbstractBaseThread.py +++ b/src/urh/dev/gr/AbstractBaseThread.py @@ -37,7 +37,6 @@ def __init__(self, freq, sample_rate, bandwidth, gain, if_gain, baseband_gain, r self._antenna_index = 0 self._channel_index = 0 self._receiving = receiving # False for Sender-Thread - self.device_args = "" # e.g. addr=192.168.10.2 self.device = "USRP" self.current_index = 0 @@ -215,10 +214,6 @@ def initialize_process(self): "--gain", str(self.gain), "--bandwidth", str(self.bandwidth), "--port", str(self.gr_port)] - if self.device.upper() == "USRP": - if self.device_args: - options.extend(["--device-args", self.device_args]) - if self.device.upper() == "HACKRF": options.extend(["--if-gain", str(self.if_gain), "--baseband-gain", str(self.baseband_gain)]) diff --git a/src/urh/dev/native/Device.py b/src/urh/dev/native/Device.py index c531ee72ad..cb4c216eca 100644 --- a/src/urh/dev/native/Device.py +++ b/src/urh/dev/native/Device.py @@ -47,6 +47,10 @@ class Command(Enum): Command.SET_BB_GAIN.name: {"rx": "set_baseband_gain"} } + @classmethod + def get_device_list(cls): + return [] + @classmethod def process_command(cls, command, ctrl_connection, is_tx: bool): is_rx = not is_tx @@ -78,11 +82,7 @@ def setup_device(cls, ctrl_connection: Connection, device_identifier): @classmethod def init_device(cls, ctrl_connection: Connection, is_tx: bool, parameters: OrderedDict) -> bool: - if "identifier" in parameters: - identifier = parameters["identifier"] - else: - identifier = None - if cls.setup_device(ctrl_connection, device_identifier=identifier): + if cls.setup_device(ctrl_connection, device_identifier=parameters["identifier"]): for parameter, value in parameters.items(): cls.process_command((parameter, value), ctrl_connection, is_tx) return True @@ -247,6 +247,9 @@ def __init__(self, center_freq, sample_rate, bandwidth, gain, if_gain=1, baseban self.send_buffer = None self.send_buffer_reader = None + self.device_serial = None + self.device_number = 0 + self.emit_data_received_signal = False # used for protocol sniffer self.samples_to_send = np.array([], dtype=np.complex64) @@ -274,6 +277,10 @@ def _start_read_message_thread(self): self.read_dev_msg_thread.daemon = True self.read_dev_msg_thread.start() + @property + def has_multi_device_support(self): + return False + @property def current_sent_sample(self): return self._current_sent_sample.value // 2 @@ -297,7 +304,8 @@ def device_parameters(self) -> OrderedDict: (self.Command.SET_BANDWIDTH.name, self.bandwidth), (self.Command.SET_RF_GAIN.name, self.gain), (self.Command.SET_IF_GAIN.name, self.if_gain), - (self.Command.SET_BB_GAIN.name, self.baseband_gain)]) + (self.Command.SET_BB_GAIN.name, self.baseband_gain), + ("identifier", self.device_serial)]) @property def send_config(self) -> SendConfig: @@ -562,7 +570,6 @@ def stop_rx_mode(self, msg): except OSError as e: logger.exception(e) - def start_tx_mode(self, samples_to_send: np.ndarray = None, repeats=None, resume=False): self.is_transmitting = True self.parent_ctrl_conn, self.child_ctrl_conn = Pipe() @@ -616,7 +623,9 @@ def read_device_messages(self): try: message = self.parent_ctrl_conn.recv() try: - action, return_code = message.split(":") + splitted = message.split(":") + action = ":".join(splitted[:-1]) + return_code = splitted[-1] self.log_retcode(int(return_code), action) except ValueError: self.device_messages.append("{0}: {1}".format(self.__class__.__name__, message)) diff --git a/src/urh/dev/native/ExtensionHelper.py b/src/urh/dev/native/ExtensionHelper.py index 3030efa776..1415709b4a 100644 --- a/src/urh/dev/native/ExtensionHelper.py +++ b/src/urh/dev/native/ExtensionHelper.py @@ -13,19 +13,17 @@ DEVICES = { "airspy": {"lib": "airspy", "test_function": "open"}, - "hackrf": {"lib": "hackrf", "test_function": "hackrf_init"}, + "hackrf": {"lib": "hackrf", "test_function": "hackrf_init", + "extras": {"HACKRF_MULTI_DEVICE": "hackrf_open_by_serial"}}, "limesdr": {"lib": "LimeSuite", "test_function": "LMS_GetDeviceList"}, - "rtlsdr": {"lib": "rtlsdr", "test_function": "rtlsdr_set_tuner_bandwidth"}, + "rtlsdr": {"lib": "rtlsdr", "test_function": "rtlsdr_get_device_name", + "extras": {"RTLSDR_BANDWIDTH": "rtlsdr_set_tuner_bandwidth"}}, # Use C only for USRP to avoid boost dependency "usrp": {"lib": "uhd", "test_function": "uhd_usrp_find", "language": "c"}, "sdrplay": {"lib": "mir_sdr_api" if sys.platform == "win32" else "mirsdrapi-rsp", "test_function": "mir_sdr_ApiVersion"} } -FALLBACKS = { - "rtlsdr": {"lib": "rtlsdr", "test_function": "rtlsdr_get_device_name"} -} - def compiler_has_function(compiler, function_name, libraries, library_dirs, include_dirs) -> bool: tmp_dir = tempfile.mkdtemp(prefix='urh-') @@ -68,7 +66,9 @@ def get_device_extensions(use_cython: bool, library_dirs=None): result = [] lib_dir = os.path.realpath(os.path.join(cur_dir, "lib/win/x64")) for dev_name, params in DEVICES.items(): - result.append(get_device_extension(dev_name, [params["lib"]], [lib_dir], include_dirs)) + # Since windows drivers are bundled we can enforce the macros + macros = [(extra, None) for extra in params.get("extras", dict())] + result.append(get_device_extension(dev_name, [params["lib"]], [lib_dir], include_dirs, macros)) return result @@ -107,44 +107,40 @@ def get_device_extensions(use_cython: bool, library_dirs=None): continue if build_device_extensions[dev_name] == 1: print("Enforcing native {0} support".format(dev_name)) - result.append( - get_device_extension(dev_name, [params["lib"]], library_dirs, include_dirs, use_cython)) + macros = __get_device_extra_macros(compiler, dev_name, [params["lib"]], library_dirs, include_dirs) + extension = get_device_extension(dev_name, [params["lib"]], library_dirs, include_dirs, macros, use_cython) + result.append(extension) continue if compiler_has_function(compiler, params["test_function"], (params["lib"],), library_dirs, include_dirs): print("Found {0} lib. Will compile with native {1} support".format(params["lib"], dev_name)) - result.append( - get_device_extension(dev_name, [params["lib"]], library_dirs, include_dirs, use_cython)) - elif dev_name in FALLBACKS: - print("Trying fallback for {0}".format(dev_name)) - params = FALLBACKS[dev_name] - dev_name += "_fallback" - if compiler_has_function(compiler, params["test_function"], (params["lib"],), library_dirs, include_dirs): - print("Found fallback. Will compile with native {0} support".format(dev_name)) - result.append( - get_device_extension(dev_name, [params["lib"]], library_dirs, include_dirs, use_cython)) + macros = __get_device_extra_macros(compiler, dev_name, [params["lib"]], library_dirs, include_dirs) + extension = get_device_extension(dev_name, [params["lib"]], library_dirs, include_dirs, macros, use_cython) + result.append(extension) else: print("Skipping native support for {1}".format(params["lib"], dev_name)) - # remove Temp file for checking - try: - os.remove("a.out") - except OSError: - pass + return result + - for filename in os.listdir(tempfile.gettempdir()): - dev_name = dev_name.replace("_fallback", "") - func_names = [DEVICES[dev_name]["test_function"]] - if dev_name in FALLBACKS: - func_names.append(FALLBACKS[dev_name]["test_function"]) +def __get_device_extra_macros(compiler, dev_name, libraries, library_dirs, include_dirs): + try: + extras = DEVICES[dev_name]["extras"] + except KeyError: + extras = dict() - if any(filename.startswith(func_name) for func_name in func_names) and filename.endswith(".c"): - os.remove(os.path.join(tempfile.gettempdir(), filename)) + macros = [] - return result + for extra, func_name in extras.items(): + if compiler_has_function(compiler, func_name, libraries, library_dirs, include_dirs): + macros.append((extra, None)) + else: + print("Skipping {} as installed driver does not support it".format(extra)) + return macros -def get_device_extension(dev_name: str, libraries: list, library_dirs: list, include_dirs: list, use_cython=False): +def get_device_extension(dev_name: str, libraries: list, library_dirs: list, include_dirs: list, macros: list, + use_cython=False): try: language = DEVICES[dev_name]["language"] except KeyError: @@ -161,6 +157,7 @@ def get_device_extension(dev_name: str, libraries: list, library_dirs: list, inc return Extension("urh.dev.native.lib." + dev_name, [cpp_file_path], libraries=libraries, library_dirs=library_dirs, + define_macros=macros, include_dirs=include_dirs, language=language) @@ -171,14 +168,6 @@ def perform_health_check() -> str: _ = import_module("urh.dev.native.lib." + device) result.append(device + " -- OK") except ImportError as e: - if device in FALLBACKS: - try: - _ = import_module("urh.dev.native.lib." + device + "_fallback") - result.append(device + " -- OK (using fallback)") - continue - except ImportError: - pass - result.append(device + " -- ERROR: " + str(e)) return "\n".join(result) diff --git a/src/urh/dev/native/HackRF.py b/src/urh/dev/native/HackRF.py index edb47ec448..7acbea8740 100644 --- a/src/urh/dev/native/HackRF.py +++ b/src/urh/dev/native/HackRF.py @@ -16,10 +16,22 @@ class HackRF(Device): Device.Command.SET_BANDWIDTH.name: "set_baseband_filter_bandwidth" }) + @classmethod + def get_device_list(cls): + result = hackrf.get_device_list() + if result is None: + return [] + return result + @classmethod def setup_device(cls, ctrl_connection: Connection, device_identifier): - ret = hackrf.setup() - ctrl_connection.send("SETUP:" + str(ret)) + ret = hackrf.setup(device_identifier) + msg = "SETUP" + if device_identifier: + msg += " ({})".format(device_identifier) + msg += ": "+str(ret) + ctrl_connection.send(msg) + return ret == 0 @classmethod @@ -73,6 +85,10 @@ def __init__(self, center_freq, sample_rate, bandwidth, gain, if_gain=1, baseban -9999: "HACKRF_ERROR_OTHER" } + @property + def has_multi_device_support(self): + return hackrf.has_multi_device_support() + @staticmethod def unpack_complex(buffer): unpacked = np.frombuffer(buffer, dtype=[('r', np.int8), ('i', np.int8)]) diff --git a/src/urh/dev/native/LimeSDR.py b/src/urh/dev/native/LimeSDR.py index 3240cbf62e..383a30ac62 100644 --- a/src/urh/dev/native/LimeSDR.py +++ b/src/urh/dev/native/LimeSDR.py @@ -1,12 +1,12 @@ from collections import OrderedDict +from multiprocessing import Array +from multiprocessing.connection import Connection import numpy as np -from multiprocessing import Array from urh.dev.native.Device import Device from urh.dev.native.lib import limesdr -from multiprocessing.connection import Connection -from array import array + class LimeSDR(Device): SYNC_RX_CHUNK_SIZE = 32768 @@ -30,6 +30,10 @@ class LimeSDR(Device): Device.Command.SET_ANTENNA_INDEX.name: "set_antenna" }) + @classmethod + def get_device_list(cls): + return limesdr.get_device_list() + @classmethod def adapt_num_read_samples_to_sample_rate(cls, sample_rate): cls.SYNC_RX_CHUNK_SIZE = 16384 * int(sample_rate / 1e6) @@ -37,8 +41,11 @@ def adapt_num_read_samples_to_sample_rate(cls, sample_rate): @classmethod def setup_device(cls, ctrl_connection: Connection, device_identifier): - ret = limesdr.open() - ctrl_connection.send("OPEN:" + str(ret)) + ret = limesdr.open(device_identifier) + if not device_identifier: + ctrl_connection.send("OPEN:" + str(ret)) + else: + ctrl_connection.send("OPEN ({}):{}".format(device_identifier, ret)) limesdr.disable_all_channels() if ret != 0: return False @@ -50,7 +57,7 @@ def setup_device(cls, ctrl_connection: Connection, device_identifier): @classmethod def init_device(cls, ctrl_connection: Connection, is_tx: bool, parameters: OrderedDict): - if not cls.setup_device(ctrl_connection, device_identifier=None): + if not cls.setup_device(ctrl_connection, device_identifier=parameters["identifier"]): return False limesdr.enable_channel(True, is_tx, parameters[cls.Command.SET_CHANNEL_INDEX.name]) @@ -64,8 +71,6 @@ def init_device(cls, ctrl_connection: Connection, is_tx: bool, parameters: Order ctrl_connection.send("Current antenna is {0}".format(antennas[limesdr.get_antenna()])) ctrl_connection.send("Current chip temperature is {0:.2f}°C".format(limesdr.get_chip_temperature())) - - return True @classmethod @@ -111,6 +116,10 @@ def __init__(self, center_freq, sample_rate, bandwidth, gain, if_gain=1, baseban def set_device_gain(self, gain): super().set_device_gain(gain * 0.01) + @property + def has_multi_device_support(self): + return True + @property def device_parameters(self): return OrderedDict([(self.Command.SET_CHANNEL_INDEX.name, self.channel_index), @@ -119,7 +128,8 @@ def device_parameters(self): (self.Command.SET_FREQUENCY.name, self.frequency), (self.Command.SET_SAMPLE_RATE.name, self.sample_rate), (self.Command.SET_BANDWIDTH.name, self.bandwidth), - (self.Command.SET_RF_GAIN.name, self.gain * 0.01)]) + (self.Command.SET_RF_GAIN.name, self.gain * 0.01), + ("identifier", self.device_serial)]) @staticmethod def unpack_complex(buffer): @@ -128,7 +138,7 @@ def unpack_complex(buffer): @staticmethod def pack_complex(complex_samples: np.ndarray): # We can pass the complex samples directly to the LimeSDR Send API - arr = Array("f", 2*len(complex_samples), lock=False) + arr = Array("f", 2 * len(complex_samples), lock=False) numpy_view = np.frombuffer(arr, dtype=np.float32) numpy_view[:] = complex_samples.view(np.float32) return arr diff --git a/src/urh/dev/native/RTLSDR.py b/src/urh/dev/native/RTLSDR.py index 376dbf724a..0a3122722d 100644 --- a/src/urh/dev/native/RTLSDR.py +++ b/src/urh/dev/native/RTLSDR.py @@ -5,10 +5,7 @@ from multiprocessing.connection import Connection from urh.dev.native.Device import Device -try: - from urh.dev.native.lib import rtlsdr -except ImportError: - import urh.dev.native.lib.rtlsdr_fallback as rtlsdr +from urh.dev.native.lib import rtlsdr from urh.util.Logger import logger @@ -23,12 +20,16 @@ class RTLSDR(Device): Device.Command.SET_DIRECT_SAMPLING_MODE.name: "set_direct_sampling" }) + @classmethod + def get_device_list(cls): + return rtlsdr.get_device_list() + @classmethod def setup_device(cls, ctrl_connection: Connection, device_identifier): # identifier gets set in self.receive_process_arguments device_number = int(device_identifier) ret = rtlsdr.open(device_number) - ctrl_connection.send("OPEN:" + str(ret)) + ctrl_connection.send("OPEN (#{}):{}".format(device_number, ret)) return ret == 0 @classmethod @@ -57,9 +58,13 @@ def __init__(self, freq, gain, srate, device_number, resume_on_full_receive_buff self.device_number = device_number + self.error_codes = { + -100: "Method not available in installed driver." + } + @staticmethod def get_bandwidth_is_adjustable(): - return hasattr(rtlsdr, "set_tuner_bandwidth") + return rtlsdr.bandwidth_is_adjustable() @property def device_parameters(self): @@ -71,6 +76,10 @@ def device_parameters(self): (self.Command.SET_RF_GAIN.name, 10 * self.gain), ("identifier", self.device_number)]) + @property + def has_multi_device_support(self): + return True + def set_device_bandwidth(self, bandwidth): if self.bandwidth_is_adjustable: super().set_device_bandwidth(bandwidth) diff --git a/src/urh/dev/native/SDRPlay.py b/src/urh/dev/native/SDRPlay.py index b243cbedb9..451f9cee56 100644 --- a/src/urh/dev/native/SDRPlay.py +++ b/src/urh/dev/native/SDRPlay.py @@ -39,6 +39,12 @@ def __init__(self, center_freq, sample_rate, bandwidth, gain, if_gain=1, baseban 13: "OUT OF MEMORY ERROR" } + @staticmethod + def device_dict_to_string(d): + hw_ver = d["hw_version"] + serial = d["serial"] + return "RSP {} ({})".format(hw_ver, serial) + @property def device_parameters(self): return OrderedDict([(self.Command.SET_ANTENNA_INDEX.name, self.antenna_index), @@ -46,7 +52,16 @@ def device_parameters(self): (self.Command.SET_SAMPLE_RATE.name, self.sample_rate), (self.Command.SET_BANDWIDTH.name, self.bandwidth), (self.Command.SET_RF_GAIN.name, self.gain), - (self.Command.SET_IF_GAIN.name, self.if_gain)]) + (self.Command.SET_IF_GAIN.name, self.if_gain), + ("identifier", self.device_number)]) + + @property + def has_multi_device_support(self): + return True + + @classmethod + def get_device_list(cls): + return [cls.device_dict_to_string(d) for d in sdrplay.get_devices()] @classmethod def enter_async_receive_mode(cls, data_connection: Connection, ctrl_connection: Connection): @@ -61,23 +76,16 @@ def enter_async_receive_mode(cls, data_connection: Connection, ctrl_connection: @classmethod def init_device(cls, ctrl_connection: Connection, is_tx: bool, parameters: OrderedDict) -> bool: - if "identifier" in parameters: - identifier = parameters["identifier"] - else: - identifier = 0 - - def device_dict_to_string(d): - hw_ver = d["hw_version"] - serial = d["serial"] - return "RSP {} ({})".format(hw_ver, serial) + identifier = parameters["identifier"] try: device_list = sdrplay.get_devices() device_number = int(identifier) - ctrl_connection.send("\nCONNECTED DEVICES: {}".format(", ".join(map(device_dict_to_string, device_list)))) + ctrl_connection.send("CONNECTED DEVICES: {}".format(", ".join(map(cls.device_dict_to_string, device_list)))) ret = sdrplay.set_device_index(device_number) ctrl_connection.send("SET DEVICE NUMBER to {}:{}".format(device_number, ret)) - except (TypeError, ValueError): + except (TypeError, ValueError) as e: + logger.exception(e) return False device_model = device_list[device_number]["hw_version"] diff --git a/src/urh/dev/native/USRP.py b/src/urh/dev/native/USRP.py index d806535198..d70b94e142 100644 --- a/src/urh/dev/native/USRP.py +++ b/src/urh/dev/native/USRP.py @@ -16,6 +16,10 @@ class USRP(Device): DEVICE_LIB = usrp ASYNCHRONOUS = False + @classmethod + def get_device_list(cls): + return usrp.find_devices("") + @classmethod def adapt_num_read_samples_to_sample_rate(cls, sample_rate): cls.SYNC_RX_CHUNK_SIZE = 16384 * int(sample_rate / 1e6) @@ -23,7 +27,10 @@ def adapt_num_read_samples_to_sample_rate(cls, sample_rate): @classmethod def setup_device(cls, ctrl_connection: Connection, device_identifier): ret = usrp.open(device_identifier) - ctrl_connection.send("OPEN:" + str(ret)) + if device_identifier: + ctrl_connection.send("OPEN ({}):{}".format(device_identifier, ret)) + else: + ctrl_connection.send("OPEN:" + str(ret)) success = ret == 0 if success: device_repr = usrp.get_device_representation() @@ -70,12 +77,15 @@ def __init__(self, center_freq, sample_rate, bandwidth, gain, if_gain=1, baseban super().__init__(center_freq=center_freq, sample_rate=sample_rate, bandwidth=bandwidth, gain=gain, if_gain=if_gain, baseband_gain=baseband_gain, resume_on_full_receive_buffer=resume_on_full_receive_buffer) - self.device_args = "" self.success = 0 def set_device_gain(self, gain): super().set_device_gain(gain * 0.01) + @property + def has_multi_device_support(self): + return True + @property def device_parameters(self): return OrderedDict([(self.Command.SET_CHANNEL_INDEX.name, self.channel_index), @@ -85,7 +95,7 @@ def device_parameters(self): (self.Command.SET_SAMPLE_RATE.name, self.sample_rate), (self.Command.SET_BANDWIDTH.name, self.bandwidth), (self.Command.SET_RF_GAIN.name, self.gain * 0.01), - ("identifier", self.device_args)]) + ("identifier", self.device_serial)]) @staticmethod def unpack_complex(buffer): diff --git a/src/urh/dev/native/includes/config.h b/src/urh/dev/native/includes/config.h new file mode 100644 index 0000000000..670c9fea16 --- /dev/null +++ b/src/urh/dev/native/includes/config.h @@ -0,0 +1,11 @@ +#ifdef RTLSDR_BANDWIDTH +#define RTLSDR_HAS_BANDWIDTH 1 +#else +#define RTLSDR_HAS_BANDWIDTH 0 +#endif + +#ifdef HACKRF_MULTI_DEVICE +#define HACKRF_HAS_MULTI_DEVICE 1 +#else +#define HACKRF_HAS_MULTI_DEVICE 0 +#endif \ No newline at end of file diff --git a/src/urh/dev/native/includes/libhackrf/hackrf.h b/src/urh/dev/native/includes/libhackrf/hackrf.h index 130f33e9f1..98ef4817c4 100644 --- a/src/urh/dev/native/includes/libhackrf/hackrf.h +++ b/src/urh/dev/native/includes/libhackrf/hackrf.h @@ -8,12 +8,12 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Great Scott Gadgets nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -28,7 +28,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI #ifdef _WIN32 #define ADD_EXPORTS - + /* You should define ADD_EXPORTS *only* when building the DLL. */ #ifdef ADD_EXPORTS #define ADDAPI __declspec(dllexport) @@ -47,6 +47,9 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI #endif +#define SAMPLES_PER_BLOCK 16384 +#define MAX_SWEEP_RANGES 10 + enum hackrf_error { HACKRF_SUCCESS = 0, HACKRF_TRUE = 1, @@ -59,6 +62,7 @@ enum hackrf_error { HACKRF_ERROR_STREAMING_THREAD_ERR = -1002, HACKRF_ERROR_STREAMING_STOPPED = -1003, HACKRF_ERROR_STREAMING_EXIT_CALLED = -1004, + HACKRF_ERROR_USB_API_VERSION = -1005, HACKRF_ERROR_OTHER = -9999, }; @@ -66,15 +70,39 @@ enum hackrf_board_id { BOARD_ID_JELLYBEAN = 0, BOARD_ID_JAWBREAKER = 1, BOARD_ID_HACKRF_ONE = 2, + BOARD_ID_RAD1O = 3, BOARD_ID_INVALID = 0xFF, }; +enum hackrf_usb_board_id { + USB_BOARD_ID_JAWBREAKER = 0x604B, + USB_BOARD_ID_HACKRF_ONE = 0x6089, + USB_BOARD_ID_RAD1O = 0xCC15, + USB_BOARD_ID_INVALID = 0xFFFF, +}; + enum rf_path_filter { RF_PATH_FILTER_BYPASS = 0, RF_PATH_FILTER_LOW_PASS = 1, RF_PATH_FILTER_HIGH_PASS = 2, }; +enum operacake_ports { + OPERACAKE_PA1 = 0, + OPERACAKE_PA2 = 1, + OPERACAKE_PA3 = 2, + OPERACAKE_PA4 = 3, + OPERACAKE_PB1 = 4, + OPERACAKE_PB2 = 5, + OPERACAKE_PB3 = 6, + OPERACAKE_PB4 = 7, +}; + +enum sweep_style { + LINEAR = 0, + INTERLEAVED = 1, +}; + typedef struct hackrf_device hackrf_device; typedef struct { @@ -91,6 +119,18 @@ typedef struct { uint32_t serial_no[4]; } read_partid_serialno_t; + +struct hackrf_device_list { + char **serial_numbers; + enum hackrf_usb_board_id *usb_board_ids; + int *usb_device_index; + int devicecount; + + void **usb_devices; + int usb_devicecount; +}; +typedef struct hackrf_device_list hackrf_device_list_t; + typedef int (*hackrf_sample_block_cb_fn)(hackrf_transfer* transfer); #ifdef __cplusplus @@ -100,30 +140,38 @@ extern "C" extern ADDAPI int ADDCALL hackrf_init(); extern ADDAPI int ADDCALL hackrf_exit(); - + +extern ADDAPI const char* ADDCALL hackrf_library_version(); +extern ADDAPI const char* ADDCALL hackrf_library_release(); + +extern ADDAPI hackrf_device_list_t* ADDCALL hackrf_device_list(); +extern ADDAPI int ADDCALL hackrf_device_list_open(hackrf_device_list_t *list, int idx, hackrf_device** device); +extern ADDAPI void ADDCALL hackrf_device_list_free(hackrf_device_list_t *list); + extern ADDAPI int ADDCALL hackrf_open(hackrf_device** device); +extern ADDAPI int ADDCALL hackrf_open_by_serial(const char* const desired_serial_number, hackrf_device** device); extern ADDAPI int ADDCALL hackrf_close(hackrf_device* device); - + extern ADDAPI int ADDCALL hackrf_start_rx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* rx_ctx); extern ADDAPI int ADDCALL hackrf_stop_rx(hackrf_device* device); - + extern ADDAPI int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* tx_ctx); extern ADDAPI int ADDCALL hackrf_stop_tx(hackrf_device* device); /* return HACKRF_TRUE if success */ extern ADDAPI int ADDCALL hackrf_is_streaming(hackrf_device* device); - + extern ADDAPI int ADDCALL hackrf_max2837_read(hackrf_device* device, uint8_t register_number, uint16_t* value); extern ADDAPI int ADDCALL hackrf_max2837_write(hackrf_device* device, uint8_t register_number, uint16_t value); - + extern ADDAPI int ADDCALL hackrf_si5351c_read(hackrf_device* device, uint16_t register_number, uint16_t* value); extern ADDAPI int ADDCALL hackrf_si5351c_write(hackrf_device* device, uint16_t register_number, uint16_t value); - + extern ADDAPI int ADDCALL hackrf_set_baseband_filter_bandwidth(hackrf_device* device, const uint32_t bandwidth_hz); - + extern ADDAPI int ADDCALL hackrf_rffc5071_read(hackrf_device* device, uint8_t register_number, uint16_t* value); extern ADDAPI int ADDCALL hackrf_rffc5071_write(hackrf_device* device, uint8_t register_number, uint16_t value); - + extern ADDAPI int ADDCALL hackrf_spiflash_erase(hackrf_device* device); extern ADDAPI int ADDCALL hackrf_spiflash_write(hackrf_device* device, const uint32_t address, const uint16_t length, unsigned char* const data); extern ADDAPI int ADDCALL hackrf_spiflash_read(hackrf_device* device, const uint32_t address, const uint16_t length, unsigned char* data); @@ -131,9 +179,10 @@ extern ADDAPI int ADDCALL hackrf_spiflash_read(hackrf_device* device, const uint /* device will need to be reset after hackrf_cpld_write */ extern ADDAPI int ADDCALL hackrf_cpld_write(hackrf_device* device, unsigned char* const data, const unsigned int total_length); - + extern ADDAPI int ADDCALL hackrf_board_id_read(hackrf_device* device, uint8_t* value); extern ADDAPI int ADDCALL hackrf_version_string_read(hackrf_device* device, char* version, uint8_t length); +extern ADDAPI int ADDCALL hackrf_usb_api_version_read(hackrf_device* device, uint16_t* version); extern ADDAPI int ADDCALL hackrf_set_freq(hackrf_device* device, const uint64_t freq_hz); extern ADDAPI int ADDCALL hackrf_set_freq_explicit(hackrf_device* device, @@ -150,10 +199,10 @@ extern ADDAPI int ADDCALL hackrf_set_amp_enable(hackrf_device* device, const uin extern ADDAPI int ADDCALL hackrf_board_partid_serialno_read(hackrf_device* device, read_partid_serialno_t* read_partid_serialno); -/* range 0-40 step 8db */ +/* range 0-40 step 8d, IF gain in osmosdr */ extern ADDAPI int ADDCALL hackrf_set_lna_gain(hackrf_device* device, uint32_t value); -/* range 0-62 step 2db */ +/* range 0-62 step 2db, BB gain in osmosdr */ extern ADDAPI int ADDCALL hackrf_set_vga_gain(hackrf_device* device, uint32_t value); /* range 0-47 step 1db */ @@ -164,6 +213,7 @@ extern ADDAPI int ADDCALL hackrf_set_antenna_enable(hackrf_device* device, const extern ADDAPI const char* ADDCALL hackrf_error_name(enum hackrf_error errcode); extern ADDAPI const char* ADDCALL hackrf_board_id_name(enum hackrf_board_id board_id); +extern ADDAPI const char* ADDCALL hackrf_usb_board_id_name(enum hackrf_usb_board_id usb_board_id); extern ADDAPI const char* ADDCALL hackrf_filter_path_name(const enum rf_path_filter path); /* Compute nearest freq for bw filter (manual filter) */ @@ -171,8 +221,28 @@ extern ADDAPI uint32_t ADDCALL hackrf_compute_baseband_filter_bw_round_down_lt(c /* Compute best default value depending on sample rate (auto filter) */ extern ADDAPI uint32_t ADDCALL hackrf_compute_baseband_filter_bw(const uint32_t bandwidth_hz); +/* All features below require USB API version 0x1002 or higher) */ + +/* set hardware sync mode */ +extern ADDAPI int ADDCALL hackrf_set_hw_sync_mode(hackrf_device* device, const uint8_t value); + +/* Start sweep mode */ +extern ADDAPI int ADDCALL hackrf_init_sweep(hackrf_device* device, + const uint16_t* frequency_list, const int num_ranges, + const uint32_t num_samples, const uint32_t step_width, + const uint32_t offset, const enum sweep_style style); + +/* Operacake functions */ +extern ADDAPI int ADDCALL hackrf_get_operacake_boards(hackrf_device* device, uint8_t* boards); +extern ADDAPI int ADDCALL hackrf_set_operacake_ports(hackrf_device* device, + uint8_t address, + uint8_t port_a, + uint8_t port_b); + +extern ADDAPI int ADDCALL hackrf_reset(hackrf_device* device); + #ifdef __cplusplus } // __cplusplus defined. #endif -#endif//__HACKRF_H__ +#endif /*__HACKRF_H__*/ diff --git a/src/urh/dev/native/lib/chackrf.pxd b/src/urh/dev/native/lib/chackrf.pxd index 3d63a6445e..a85e0c686a 100644 --- a/src/urh/dev/native/lib/chackrf.pxd +++ b/src/urh/dev/native/lib/chackrf.pxd @@ -1,3 +1,6 @@ +cdef extern from "config.h": + cdef bint HACKRF_HAS_MULTI_DEVICE + cdef extern from "libhackrf/hackrf.h": enum hackrf_error: HACKRF_SUCCESS = 0 @@ -74,7 +77,7 @@ cdef extern from "libhackrf/hackrf.h": int hackrf_init() int hackrf_exit() - hackrf_device_list_t* hackrf_device_list() + hackrf_device_list_t* hackrf_device_list() int hackrf_device_list_open(hackrf_device_list_t *list, int idx, hackrf_device** device) void hackrf_device_list_free(hackrf_device_list_t *list) diff --git a/src/urh/dev/native/lib/crtlsdr.pxd b/src/urh/dev/native/lib/crtlsdr.pxd index 1701258e2b..76df34a107 100644 --- a/src/urh/dev/native/lib/crtlsdr.pxd +++ b/src/urh/dev/native/lib/crtlsdr.pxd @@ -1,3 +1,6 @@ +cdef extern from "config.h": + cdef bint RTLSDR_HAS_BANDWIDTH + cdef extern from "rtl-sdr.h": ctypedef struct rtlsdr_dev_t: pass diff --git a/src/urh/dev/native/lib/cusrp.pxd b/src/urh/dev/native/lib/cusrp.pxd index 845df0c32a..e7744c4142 100644 --- a/src/urh/dev/native/lib/cusrp.pxd +++ b/src/urh/dev/native/lib/cusrp.pxd @@ -106,6 +106,8 @@ cdef extern from "uhd/types/string_vector.h": ctypedef uhd_string_vector_t* uhd_string_vector_handle; uhd_error uhd_string_vector_make(uhd_string_vector_handle *h) uhd_error uhd_string_vector_free(uhd_string_vector_handle *h) + uhd_error uhd_string_vector_size(uhd_string_vector_handle h, size_t *size_out) + uhd_error uhd_string_vector_at(uhd_string_vector_handle h, size_t index, char* value_out, size_t strbuffer_len) cdef extern from "uhd/usrp/usrp.h": struct uhd_rx_streamer diff --git a/src/urh/dev/native/lib/hackrf.cpp b/src/urh/dev/native/lib/hackrf.cpp index 60942220a3..a7eeff50fe 100644 --- a/src/urh/dev/native/lib/hackrf.cpp +++ b/src/urh/dev/native/lib/hackrf.cpp @@ -1,9 +1,16 @@ -/* Generated by Cython 0.28 */ +/* Generated by Cython 0.28.2 */ /* BEGIN: Cython Metadata { "distutils": { + "define_macros": [ + [ + "HACKRF_MULTI_DEVICE", + null + ] + ], "depends": [ + "/home/joe/GIT/urh/src/urh/dev/native/includes/config.h", "/home/joe/GIT/urh/src/urh/dev/native/includes/libhackrf/hackrf.h" ], "extra_compile_args": [ @@ -32,7 +39,7 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_28" +#define CYTHON_ABI "0_28_2" #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -600,6 +607,7 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__urh__dev__native__lib__hackrf #define __PYX_HAVE_API__urh__dev__native__lib__hackrf /* Early includes */ +#include "config.h" #include "libhackrf/hackrf.h" #include #include @@ -926,6 +934,19 @@ struct __pyx_array_obj; struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; +struct __pyx_opt_args_3urh_3dev_6native_3lib_6hackrf_open; + +/* "urh/dev/native/lib/hackrf.pyx":56 + * return chackrf.hackrf_init() + * + * cpdef open(str serial_number=""): # <<<<<<<<<<<<<< + * if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: + * return chackrf.hackrf_open(&_c_device) + */ +struct __pyx_opt_args_3urh_3dev_6native_3lib_6hackrf_open { + int __pyx_n; + PyObject *serial_number; +}; /* "View.MemoryView":104 * @@ -1264,6 +1285,24 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + /* IncludeStringH.proto */ #include @@ -1287,23 +1326,22 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); @@ -1429,23 +1467,6 @@ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { #endif } -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); @@ -1624,10 +1645,6 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo /* Module declarations from 'chackrf' */ -/* Module declarations from 'cython.view' */ - -/* Module declarations from 'cython' */ - /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdlib' */ @@ -1650,11 +1667,11 @@ static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transfer *); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transfer *); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_has_multi_device_support(int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(PyObject *, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_init(int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_open(int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_open(int __pyx_skip_dispatch, struct __pyx_opt_args_3urh_3dev_6native_3lib_6hackrf_open *__pyx_optional_args); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_exit(int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_reopen(int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_close(int __pyx_skip_dispatch); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf_start_rx_mode(PyObject *, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_stop_rx_mode(int __pyx_skip_dispatch); /*proto*/ @@ -1671,6 +1688,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_set_baseband_gain(PyObje static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_set_sample_rate(PyObject *, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_set_amp_enable(PyObject *, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_set_baseband_filter_bandwidth(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_get_device_list(int __pyx_skip_dispatch); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -1777,6 +1795,7 @@ static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_Cython_HackRF[] = "Cython-HackRF:"; static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_serial_number[] = "serial_number"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; @@ -1882,6 +1901,7 @@ static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_reduce; static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_reduce_ex; +static PyObject *__pyx_n_s_serial_number; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shape; @@ -1902,11 +1922,11 @@ static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_n_s_unpack; static PyObject *__pyx_n_s_update; static PyObject *__pyx_n_s_urh_util_Logger; -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_setup(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_2init(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_4open(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_6exit(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_8reopen(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_has_multi_device_support(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_2setup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_4init(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_6open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial_number); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_8exit(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_10close(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_12start_rx_mode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_14stop_rx_mode(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ @@ -1923,6 +1943,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_34set_baseband_gain(CYT static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_36set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample_rate); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_38set_amp_enable(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_40set_baseband_filter_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_42get_device_list(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -2004,7 +2025,7 @@ static PyObject *__pyx_tuple__28; static PyObject *__pyx_codeobj__29; /* Late includes */ -/* "urh/dev/native/lib/hackrf.pyx":13 +/* "urh/dev/native/lib/hackrf.pyx":12 * cdef int RUNNING = 0 * * cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: # <<<<<<<<<<<<<< @@ -2041,7 +2062,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf #endif __Pyx_RefNannySetupContext("_c_callback_recv", 0); - /* "urh/dev/native/lib/hackrf.pyx":15 + /* "urh/dev/native/lib/hackrf.pyx":14 * cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: * global f, RUNNING * try: # <<<<<<<<<<<<<< @@ -2057,14 +2078,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "urh/dev/native/lib/hackrf.pyx":16 + /* "urh/dev/native/lib/hackrf.pyx":15 * global f, RUNNING * try: * ( f)(transfer.buffer[0:transfer.valid_length]) # <<<<<<<<<<<<<< * return RUNNING * except Exception as e: */ - __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_transfer->buffer) + 0, __pyx_v_transfer->valid_length - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_transfer->buffer) + 0, __pyx_v_transfer->valid_length - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_3urh_3dev_6native_3lib_6hackrf_f)); __pyx_t_6 = __pyx_v_3urh_3dev_6native_3lib_6hackrf_f; __pyx_t_7 = NULL; @@ -2078,14 +2099,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf } } if (!__pyx_t_7) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L3_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -2094,20 +2115,20 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 15, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } @@ -2115,7 +2136,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "urh/dev/native/lib/hackrf.pyx":17 + /* "urh/dev/native/lib/hackrf.pyx":16 * try: * ( f)(transfer.buffer[0:transfer.valid_length]) * return RUNNING # <<<<<<<<<<<<<< @@ -2125,7 +2146,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __pyx_r = __pyx_v_3urh_3dev_6native_3lib_6hackrf_RUNNING; goto __pyx_L7_try_return; - /* "urh/dev/native/lib/hackrf.pyx":15 + /* "urh/dev/native/lib/hackrf.pyx":14 * cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: * global f, RUNNING * try: # <<<<<<<<<<<<<< @@ -2140,7 +2161,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "urh/dev/native/lib/hackrf.pyx":18 + /* "urh/dev/native/lib/hackrf.pyx":17 * ( f)(transfer.buffer[0:transfer.valid_length]) * return RUNNING * except Exception as e: # <<<<<<<<<<<<<< @@ -2150,7 +2171,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_9) { __Pyx_AddTraceback("urh.dev.native.lib.hackrf._c_callback_recv", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(0, 18, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(0, 17, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_8); @@ -2158,21 +2179,21 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __pyx_v_e = __pyx_t_6; /*try:*/ { - /* "urh/dev/native/lib/hackrf.pyx":19 + /* "urh/dev/native/lib/hackrf.pyx":18 * return RUNNING * except Exception as e: * logger.error("Cython-HackRF:" + str(e)) # <<<<<<<<<<<<<< * return -1 * */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_e); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_e); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Cython_HackRF, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Cython_HackRF, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -2186,14 +2207,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf } } if (!__pyx_t_7) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_5); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_10)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_11}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -2202,20 +2223,20 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_11}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else #endif { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_11); __pyx_t_11 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L14_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } @@ -2223,12 +2244,12 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "urh/dev/native/lib/hackrf.pyx":20 + /* "urh/dev/native/lib/hackrf.pyx":19 * except Exception as e: * logger.error("Cython-HackRF:" + str(e)) * return -1 # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) with gil: */ __pyx_r = -1; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2237,7 +2258,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf goto __pyx_L13_return; } - /* "urh/dev/native/lib/hackrf.pyx":18 + /* "urh/dev/native/lib/hackrf.pyx":17 * ( f)(transfer.buffer[0:transfer.valid_length]) * return RUNNING * except Exception as e: # <<<<<<<<<<<<<< @@ -2294,7 +2315,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "urh/dev/native/lib/hackrf.pyx":15 + /* "urh/dev/native/lib/hackrf.pyx":14 * cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: * global f, RUNNING * try: # <<<<<<<<<<<<<< @@ -2320,7 +2341,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf goto __pyx_L0; } - /* "urh/dev/native/lib/hackrf.pyx":13 + /* "urh/dev/native/lib/hackrf.pyx":12 * cdef int RUNNING = 0 * * cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: # <<<<<<<<<<<<<< @@ -2349,9 +2370,9 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_recv(hackrf_transf return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":25 - * @cython.initializedcheck(False) - * @cython.wraparound(False) +/* "urh/dev/native/lib/hackrf.pyx":21 + * return -1 + * * cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) with gil: # <<<<<<<<<<<<<< * global f, RUNNING * # tostring() is a compatibility (numpy<1.9) alias for tobytes(). Despite its name it returns bytes not strings. @@ -2380,7 +2401,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf #endif __Pyx_RefNannySetupContext("_c_callback_send", 0); - /* "urh/dev/native/lib/hackrf.pyx":29 + /* "urh/dev/native/lib/hackrf.pyx":25 * # tostring() is a compatibility (numpy<1.9) alias for tobytes(). Despite its name it returns bytes not strings. * cdef unsigned int i * cdef unsigned int valid_length = transfer.valid_length # <<<<<<<<<<<<<< @@ -2389,14 +2410,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf */ __pyx_v_valid_length = ((unsigned int)__pyx_v_transfer->valid_length); - /* "urh/dev/native/lib/hackrf.pyx":30 + /* "urh/dev/native/lib/hackrf.pyx":26 * cdef unsigned int i * cdef unsigned int valid_length = transfer.valid_length * cdef unsigned char[:] data = ( f)(valid_length) # <<<<<<<<<<<<<< * cdef unsigned int loop_end = min(len(data), valid_length) * */ - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_valid_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_valid_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_3urh_3dev_6native_3lib_6hackrf_f)); __pyx_t_3 = __pyx_v_3urh_3dev_6native_3lib_6hackrf_f; __pyx_t_4 = NULL; @@ -2410,14 +2431,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf } } if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -2426,32 +2447,32 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_data = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL; - /* "urh/dev/native/lib/hackrf.pyx":31 + /* "urh/dev/native/lib/hackrf.pyx":27 * cdef unsigned int valid_length = transfer.valid_length * cdef unsigned char[:] data = ( f)(valid_length) * cdef unsigned int loop_end = min(len(data), valid_length) # <<<<<<<<<<<<<< @@ -2467,7 +2488,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf } __pyx_v_loop_end = __pyx_t_9; - /* "urh/dev/native/lib/hackrf.pyx":33 + /* "urh/dev/native/lib/hackrf.pyx":29 * cdef unsigned int loop_end = min(len(data), valid_length) * * for i in range(0, loop_end): # <<<<<<<<<<<<<< @@ -2479,7 +2500,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "urh/dev/native/lib/hackrf.pyx":34 + /* "urh/dev/native/lib/hackrf.pyx":30 * * for i in range(0, loop_end): * transfer.buffer[i] = data[i] # <<<<<<<<<<<<<< @@ -2490,7 +2511,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf (__pyx_v_transfer->buffer[__pyx_v_i]) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_8 * __pyx_v_data.strides[0]) ))); } - /* "urh/dev/native/lib/hackrf.pyx":36 + /* "urh/dev/native/lib/hackrf.pyx":32 * transfer.buffer[i] = data[i] * * for i in range(loop_end, valid_length): # <<<<<<<<<<<<<< @@ -2502,7 +2523,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf for (__pyx_t_11 = __pyx_v_loop_end; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "urh/dev/native/lib/hackrf.pyx":37 + /* "urh/dev/native/lib/hackrf.pyx":33 * * for i in range(loop_end, valid_length): * transfer.buffer[i] = 0 # <<<<<<<<<<<<<< @@ -2512,7 +2533,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf (__pyx_v_transfer->buffer[__pyx_v_i]) = 0; } - /* "urh/dev/native/lib/hackrf.pyx":41 + /* "urh/dev/native/lib/hackrf.pyx":37 * # Need to return -1 on finish, otherwise stop_tx_mode hangs forever * # Furthermore, this leads to windows issue https://github.com/jopohl/urh/issues/360 * return RUNNING # <<<<<<<<<<<<<< @@ -2522,9 +2543,9 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf __pyx_r = __pyx_v_3urh_3dev_6native_3lib_6hackrf_RUNNING; goto __pyx_L0; - /* "urh/dev/native/lib/hackrf.pyx":25 - * @cython.initializedcheck(False) - * @cython.wraparound(False) + /* "urh/dev/native/lib/hackrf.pyx":21 + * return -1 + * * cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) with gil: # <<<<<<<<<<<<<< * global f, RUNNING * # tostring() is a compatibility (numpy<1.9) alias for tobytes(). Despite its name it returns bytes not strings. @@ -2549,50 +2570,137 @@ static int __pyx_f_3urh_3dev_6native_3lib_6hackrf__c_callback_send(hackrf_transf return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":46 +/* "urh/dev/native/lib/hackrf.pyx":42 + * cdef int hackrf_success = chackrf.HACKRF_SUCCESS + * + * cpdef has_multi_device_support(): # <<<<<<<<<<<<<< + * return chackrf.HACKRF_HAS_MULTI_DEVICE != 0 + * + */ + +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1has_multi_device_support(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_has_multi_device_support(CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("has_multi_device_support", 0); + + /* "urh/dev/native/lib/hackrf.pyx":43 + * + * cpdef has_multi_device_support(): + * return chackrf.HACKRF_HAS_MULTI_DEVICE != 0 # <<<<<<<<<<<<<< + * + * cpdef setup(str serial): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((HACKRF_HAS_MULTI_DEVICE != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "urh/dev/native/lib/hackrf.pyx":42 * cdef int hackrf_success = chackrf.HACKRF_SUCCESS * - * cpdef setup(): # <<<<<<<<<<<<<< + * cpdef has_multi_device_support(): # <<<<<<<<<<<<<< + * return chackrf.HACKRF_HAS_MULTI_DEVICE != 0 + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.has_multi_device_support", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1has_multi_device_support(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1has_multi_device_support(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("has_multi_device_support (wrapper)", 0); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_has_multi_device_support(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_has_multi_device_support(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("has_multi_device_support", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_has_multi_device_support(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.has_multi_device_support", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "urh/dev/native/lib/hackrf.pyx":45 + * return chackrf.HACKRF_HAS_MULTI_DEVICE != 0 + * + * cpdef setup(str serial): # <<<<<<<<<<<<<< * """ * Convenience method for init + open. This one is used by HackRF class. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1setup(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(CYTHON_UNUSED int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3setup(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(PyObject *__pyx_v_serial, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_3urh_3dev_6native_3lib_6hackrf_open __pyx_t_2; __Pyx_RefNannySetupContext("setup", 0); - /* "urh/dev/native/lib/hackrf.pyx":51 + /* "urh/dev/native/lib/hackrf.pyx":50 * :return: * """ * init() # <<<<<<<<<<<<<< - * return open() + * return open(serial) * */ - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_init(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_init(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urh/dev/native/lib/hackrf.pyx":52 + /* "urh/dev/native/lib/hackrf.pyx":51 * """ * init() - * return open() # <<<<<<<<<<<<<< + * return open(serial) # <<<<<<<<<<<<<< * * cpdef init(): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_open(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.serial_number = __pyx_v_serial; + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_open(0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/hackrf.pyx":46 - * cdef int hackrf_success = chackrf.HACKRF_SUCCESS + /* "urh/dev/native/lib/hackrf.pyx":45 + * return chackrf.HACKRF_HAS_MULTI_DEVICE != 0 * - * cpdef setup(): # <<<<<<<<<<<<<< + * cpdef setup(str serial): # <<<<<<<<<<<<<< * """ * Convenience method for init + open. This one is used by HackRF class. */ @@ -2609,26 +2717,31 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(CYTHON_UNUSED int } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1setup(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6hackrf_setup[] = "\n Convenience method for init + open. This one is used by HackRF class.\n :return: \n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1setup(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3setup(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6hackrf_2setup[] = "\n Convenience method for init + open. This one is used by HackRF class.\n :return: \n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3setup(PyObject *__pyx_self, PyObject *__pyx_v_serial) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("setup (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_setup(__pyx_self); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_serial), (&PyUnicode_Type), 1, "serial", 1))) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_2setup(__pyx_self, ((PyObject*)__pyx_v_serial)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_setup(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_2setup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("setup", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_setup(__pyx_v_serial, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2645,37 +2758,37 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_setup(CYTHON_UNUSED PyO return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":54 - * return open() +/* "urh/dev/native/lib/hackrf.pyx":53 + * return open(serial) * * cpdef init(): # <<<<<<<<<<<<<< * return chackrf.hackrf_init() * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_init(CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("init", 0); - /* "urh/dev/native/lib/hackrf.pyx":55 + /* "urh/dev/native/lib/hackrf.pyx":54 * * cpdef init(): * return chackrf.hackrf_init() # <<<<<<<<<<<<<< * - * cpdef open(): + * cpdef open(str serial_number=""): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_init()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_init()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/hackrf.pyx":54 - * return open() + /* "urh/dev/native/lib/hackrf.pyx":53 + * return open(serial) * * cpdef init(): # <<<<<<<<<<<<<< * return chackrf.hackrf_init() @@ -2694,25 +2807,25 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_init(CYTHON_UNUSED int _ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_2init(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_4init(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_2init(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_4init(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("init", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_init(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_init(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2729,74 +2842,206 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_2init(CYTHON_UNUSED PyO return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":57 +/* "urh/dev/native/lib/hackrf.pyx":56 * return chackrf.hackrf_init() * - * cpdef open(): # <<<<<<<<<<<<<< - * return chackrf.hackrf_open(&_c_device) - * + * cpdef open(str serial_number=""): # <<<<<<<<<<<<<< + * if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: + * return chackrf.hackrf_open(&_c_device) */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5open(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_open(CYTHON_UNUSED int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_open(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_3urh_3dev_6native_3lib_6hackrf_open *__pyx_optional_args) { + PyObject *__pyx_v_serial_number = ((PyObject*)__pyx_kp_u_); + PyObject *__pyx_v_desired_serial = NULL; + char *__pyx_v_c_desired_serial; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; __Pyx_RefNannySetupContext("open", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_serial_number = __pyx_optional_args->serial_number; + } + } + + /* "urh/dev/native/lib/hackrf.pyx":57 + * + * cpdef open(str serial_number=""): + * if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: # <<<<<<<<<<<<<< + * return chackrf.hackrf_open(&_c_device) + * + */ + __pyx_t_2 = ((!(HACKRF_HAS_MULTI_DEVICE != 0)) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_serial_number != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_serial_number) != 0); + __pyx_t_3 = ((!__pyx_t_2) != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "urh/dev/native/lib/hackrf.pyx":58 + * cpdef open(str serial_number=""): + * if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: + * return chackrf.hackrf_open(&_c_device) # <<<<<<<<<<<<<< + * + * desired_serial = serial_number.encode('UTF-8') + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_From_int(hackrf_open((&__pyx_v_3urh_3dev_6native_3lib_6hackrf__c_device))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "urh/dev/native/lib/hackrf.pyx":57 + * + * cpdef open(str serial_number=""): + * if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: # <<<<<<<<<<<<<< + * return chackrf.hackrf_open(&_c_device) + * + */ + } + + /* "urh/dev/native/lib/hackrf.pyx":60 + * return chackrf.hackrf_open(&_c_device) + * + * desired_serial = serial_number.encode('UTF-8') # <<<<<<<<<<<<<< + * c_desired_serial = desired_serial + * return chackrf.hackrf_open_by_serial(c_desired_serial, &_c_device) + */ + if (unlikely(__pyx_v_serial_number == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 60, __pyx_L1_error) + } + __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_serial_number); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_desired_serial = __pyx_t_4; + __pyx_t_4 = 0; - /* "urh/dev/native/lib/hackrf.pyx":58 + /* "urh/dev/native/lib/hackrf.pyx":61 + * + * desired_serial = serial_number.encode('UTF-8') + * c_desired_serial = desired_serial # <<<<<<<<<<<<<< + * return chackrf.hackrf_open_by_serial(c_desired_serial, &_c_device) * - * cpdef open(): - * return chackrf.hackrf_open(&_c_device) # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_desired_serial); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_v_c_desired_serial = ((char *)__pyx_t_5); + + /* "urh/dev/native/lib/hackrf.pyx":62 + * desired_serial = serial_number.encode('UTF-8') + * c_desired_serial = desired_serial + * return chackrf.hackrf_open_by_serial(c_desired_serial, &_c_device) # <<<<<<<<<<<<<< * * cpdef exit(): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_open((&__pyx_v_3urh_3dev_6native_3lib_6hackrf__c_device))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(hackrf_open_by_serial(__pyx_v_c_desired_serial, (&__pyx_v_3urh_3dev_6native_3lib_6hackrf__c_device))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/hackrf.pyx":57 + /* "urh/dev/native/lib/hackrf.pyx":56 * return chackrf.hackrf_init() * - * cpdef open(): # <<<<<<<<<<<<<< - * return chackrf.hackrf_open(&_c_device) - * + * cpdef open(str serial_number=""): # <<<<<<<<<<<<<< + * if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: + * return chackrf.hackrf_open(&_c_device) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("urh.dev.native.lib.hackrf.open", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_desired_serial); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5open(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5open(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_serial_number = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("open (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_4open(__pyx_self); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serial_number,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject*)__pyx_kp_u_); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serial_number); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open") < 0)) __PYX_ERR(0, 56, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_serial_number = ((PyObject*)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("open", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_serial_number), (&PyUnicode_Type), 1, "serial_number", 1))) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_6open(__pyx_self, __pyx_v_serial_number); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_4open(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_6open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial_number) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_3urh_3dev_6native_3lib_6hackrf_open __pyx_t_2; __Pyx_RefNannySetupContext("open", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_open(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.serial_number = __pyx_v_serial_number; + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_open(0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2813,37 +3058,37 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_4open(CYTHON_UNUSED PyO return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":60 - * return chackrf.hackrf_open(&_c_device) +/* "urh/dev/native/lib/hackrf.pyx":64 + * return chackrf.hackrf_open_by_serial(c_desired_serial, &_c_device) * * cpdef exit(): # <<<<<<<<<<<<<< * return chackrf.hackrf_exit() * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_exit(CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("exit", 0); - /* "urh/dev/native/lib/hackrf.pyx":61 + /* "urh/dev/native/lib/hackrf.pyx":65 * * cpdef exit(): * return chackrf.hackrf_exit() # <<<<<<<<<<<<<< * - * cpdef reopen(): + * cpdef close(): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_exit()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_exit()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/hackrf.pyx":60 - * return chackrf.hackrf_open(&_c_device) + /* "urh/dev/native/lib/hackrf.pyx":64 + * return chackrf.hackrf_open_by_serial(c_desired_serial, &_c_device) * * cpdef exit(): # <<<<<<<<<<<<<< * return chackrf.hackrf_exit() @@ -2862,25 +3107,25 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_exit(CYTHON_UNUSED int _ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("exit (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_6exit(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_8exit(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_6exit(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_8exit(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("exit", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_exit(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_exit(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2897,103 +3142,8 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_6exit(CYTHON_UNUSED PyO return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":63 - * return chackrf.hackrf_exit() - * - * cpdef reopen(): # <<<<<<<<<<<<<< - * close() - * return open() - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9reopen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_reopen(CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("reopen", 0); - - /* "urh/dev/native/lib/hackrf.pyx":64 - * - * cpdef reopen(): - * close() # <<<<<<<<<<<<<< - * return open() - * - */ - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_close(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "urh/dev/native/lib/hackrf.pyx":65 - * cpdef reopen(): - * close() - * return open() # <<<<<<<<<<<<<< - * - * cpdef close(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_open(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "urh/dev/native/lib/hackrf.pyx":63 - * return chackrf.hackrf_exit() - * - * cpdef reopen(): # <<<<<<<<<<<<<< - * close() - * return open() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.hackrf.reopen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9reopen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9reopen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reopen (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_8reopen(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_8reopen(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("reopen", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_reopen(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.hackrf.reopen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - /* "urh/dev/native/lib/hackrf.pyx":67 - * return open() + * return chackrf.hackrf_exit() * * cpdef close(): # <<<<<<<<<<<<<< * return chackrf.hackrf_close(_c_device) @@ -3022,7 +3172,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_close(CYTHON_UNUSED int goto __pyx_L0; /* "urh/dev/native/lib/hackrf.pyx":67 - * return open() + * return chackrf.hackrf_exit() * * cpdef close(): # <<<<<<<<<<<<<< * return chackrf.hackrf_close(_c_device) @@ -5185,143 +5335,355 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_38set_amp_enable(CYTHON return __pyx_r; } -/* "urh/dev/native/lib/hackrf.pyx":152 - * return chackrf.hackrf_set_amp_enable(_c_device, val) +/* "urh/dev/native/lib/hackrf.pyx":152 + * return chackrf.hackrf_set_amp_enable(_c_device, val) + * + * cpdef set_baseband_filter_bandwidth(bandwidth_hz): # <<<<<<<<<<<<<< + * time.sleep(TIMEOUT) + * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + */ + +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth(PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_set_baseband_filter_bandwidth(PyObject *__pyx_v_bandwidth_hz, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + uint32_t __pyx_t_6; + __Pyx_RefNannySetupContext("set_baseband_filter_bandwidth", 0); + + /* "urh/dev/native/lib/hackrf.pyx":153 + * + * cpdef set_baseband_filter_bandwidth(bandwidth_hz): + * time.sleep(TIMEOUT) # <<<<<<<<<<<<<< + * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sleep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_TIMEOUT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "urh/dev/native/lib/hackrf.pyx":154 + * cpdef set_baseband_filter_bandwidth(bandwidth_hz): + * time.sleep(TIMEOUT) + * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) # <<<<<<<<<<<<<< + * + * cpdef get_device_list(): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_v_bandwidth_hz); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_set_baseband_filter_bandwidth(__pyx_v_3urh_3dev_6native_3lib_6hackrf__c_device, __pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "urh/dev/native/lib/hackrf.pyx":152 + * return chackrf.hackrf_set_amp_enable(_c_device, val) + * + * cpdef set_baseband_filter_bandwidth(bandwidth_hz): # <<<<<<<<<<<<<< + * time.sleep(TIMEOUT) + * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.set_baseband_filter_bandwidth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth(PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth(PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_baseband_filter_bandwidth (wrapper)", 0); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_40set_baseband_filter_bandwidth(__pyx_self, ((PyObject *)__pyx_v_bandwidth_hz)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_40set_baseband_filter_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("set_baseband_filter_bandwidth", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_set_baseband_filter_bandwidth(__pyx_v_bandwidth_hz, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.set_baseband_filter_bandwidth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "urh/dev/native/lib/hackrf.pyx":156 + * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + * + * cpdef get_device_list(): # <<<<<<<<<<<<<< + * if not chackrf.HACKRF_HAS_MULTI_DEVICE: + * return None + */ + +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_43get_device_list(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_get_device_list(CYTHON_UNUSED int __pyx_skip_dispatch) { + hackrf_device_list_t *__pyx_v_device_list; + PyObject *__pyx_v_result = NULL; + int __pyx_v_i; + PyObject *__pyx_v_serial_number = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("get_device_list", 0); + + /* "urh/dev/native/lib/hackrf.pyx":157 + * + * cpdef get_device_list(): + * if not chackrf.HACKRF_HAS_MULTI_DEVICE: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_1 = ((!(HACKRF_HAS_MULTI_DEVICE != 0)) != 0); + if (__pyx_t_1) { + + /* "urh/dev/native/lib/hackrf.pyx":158 + * cpdef get_device_list(): + * if not chackrf.HACKRF_HAS_MULTI_DEVICE: + * return None # <<<<<<<<<<<<<< + * + * init() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "urh/dev/native/lib/hackrf.pyx":157 + * + * cpdef get_device_list(): + * if not chackrf.HACKRF_HAS_MULTI_DEVICE: # <<<<<<<<<<<<<< + * return None + * + */ + } + + /* "urh/dev/native/lib/hackrf.pyx":160 + * return None + * + * init() # <<<<<<<<<<<<<< + * cdef chackrf.hackrf_device_list_t* device_list = chackrf.hackrf_device_list() + * + */ + __pyx_t_2 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_init(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "urh/dev/native/lib/hackrf.pyx":161 + * + * init() + * cdef chackrf.hackrf_device_list_t* device_list = chackrf.hackrf_device_list() # <<<<<<<<<<<<<< + * + * result = [] + */ + __pyx_v_device_list = hackrf_device_list(); + + /* "urh/dev/native/lib/hackrf.pyx":163 + * cdef chackrf.hackrf_device_list_t* device_list = chackrf.hackrf_device_list() + * + * result = [] # <<<<<<<<<<<<<< + * cdef int i + * for i in range(device_list.devicecount): + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_result = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "urh/dev/native/lib/hackrf.pyx":165 + * result = [] + * cdef int i + * for i in range(device_list.devicecount): # <<<<<<<<<<<<<< + * serial_number = device_list.serial_numbers[i].decode("UTF-8") + * result.append(serial_number) + */ + __pyx_t_3 = __pyx_v_device_list->devicecount; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "urh/dev/native/lib/hackrf.pyx":166 + * cdef int i + * for i in range(device_list.devicecount): + * serial_number = device_list.serial_numbers[i].decode("UTF-8") # <<<<<<<<<<<<<< + * result.append(serial_number) * - * cpdef set_baseband_filter_bandwidth(bandwidth_hz): # <<<<<<<<<<<<<< - * time.sleep(TIMEOUT) - * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) */ + __pyx_t_6 = (__pyx_v_device_list->serial_numbers[__pyx_v_i]); + __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_6, 0, strlen(__pyx_t_6), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_serial_number, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth(PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_6hackrf_set_baseband_filter_bandwidth(PyObject *__pyx_v_bandwidth_hz, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - uint32_t __pyx_t_6; - __Pyx_RefNannySetupContext("set_baseband_filter_bandwidth", 0); + /* "urh/dev/native/lib/hackrf.pyx":167 + * for i in range(device_list.devicecount): + * serial_number = device_list.serial_numbers[i].decode("UTF-8") + * result.append(serial_number) # <<<<<<<<<<<<<< + * + * chackrf.hackrf_device_list_free(device_list) + */ + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_serial_number); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 167, __pyx_L1_error) + } - /* "urh/dev/native/lib/hackrf.pyx":153 + /* "urh/dev/native/lib/hackrf.pyx":169 + * result.append(serial_number) * - * cpdef set_baseband_filter_bandwidth(bandwidth_hz): - * time.sleep(TIMEOUT) # <<<<<<<<<<<<<< - * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + * chackrf.hackrf_device_list_free(device_list) # <<<<<<<<<<<<<< + * exit() + * return result */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + hackrf_device_list_free(__pyx_v_device_list); + + /* "urh/dev/native/lib/hackrf.pyx":170 + * + * chackrf.hackrf_device_list_free(device_list) + * exit() # <<<<<<<<<<<<<< + * return result + */ + __pyx_t_2 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_exit(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sleep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_TIMEOUT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urh/dev/native/lib/hackrf.pyx":154 - * cpdef set_baseband_filter_bandwidth(bandwidth_hz): - * time.sleep(TIMEOUT) - * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) # <<<<<<<<<<<<<< + /* "urh/dev/native/lib/hackrf.pyx":171 + * chackrf.hackrf_device_list_free(device_list) + * exit() + * return result # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_v_bandwidth_hz); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_From_int(hackrf_set_baseband_filter_bandwidth(__pyx_v_3urh_3dev_6native_3lib_6hackrf__c_device, __pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "urh/dev/native/lib/hackrf.pyx":152 - * return chackrf.hackrf_set_amp_enable(_c_device, val) - * - * cpdef set_baseband_filter_bandwidth(bandwidth_hz): # <<<<<<<<<<<<<< - * time.sleep(TIMEOUT) + /* "urh/dev/native/lib/hackrf.pyx":156 * return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + * + * cpdef get_device_list(): # <<<<<<<<<<<<<< + * if not chackrf.HACKRF_HAS_MULTI_DEVICE: + * return None */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("urh.dev.native.lib.hackrf.set_baseband_filter_bandwidth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.get_device_list", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_serial_number); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth(PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth(PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_43get_device_list(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6hackrf_43get_device_list(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_baseband_filter_bandwidth (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_40set_baseband_filter_bandwidth(__pyx_self, ((PyObject *)__pyx_v_bandwidth_hz)); + __Pyx_RefNannySetupContext("get_device_list (wrapper)", 0); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6hackrf_42get_device_list(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_40set_baseband_filter_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bandwidth_hz) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_42get_device_list(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_baseband_filter_bandwidth", 0); + __Pyx_RefNannySetupContext("get_device_list", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_set_baseband_filter_bandwidth(__pyx_v_bandwidth_hz, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6hackrf_get_device_list(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5330,7 +5692,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6hackrf_40set_baseband_filter_b /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.hackrf.set_baseband_filter_bandwidth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("urh.dev.native.lib.hackrf.get_device_list", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18926,11 +19288,11 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { }; static PyMethodDef __pyx_methods[] = { - {"setup", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1setup, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6hackrf_setup}, - {"init", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3init, METH_NOARGS, 0}, - {"open", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5open, METH_NOARGS, 0}, - {"exit", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7exit, METH_NOARGS, 0}, - {"reopen", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9reopen, METH_NOARGS, 0}, + {"has_multi_device_support", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_1has_multi_device_support, METH_NOARGS, 0}, + {"setup", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_3setup, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6hackrf_2setup}, + {"init", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_5init, METH_NOARGS, 0}, + {"open", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_7open, METH_VARARGS|METH_KEYWORDS, 0}, + {"exit", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_9exit, METH_NOARGS, 0}, {"close", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_11close, METH_NOARGS, 0}, {"start_rx_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_13start_rx_mode, METH_O, 0}, {"stop_rx_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_15stop_rx_mode, METH_NOARGS, 0}, @@ -18947,6 +19309,7 @@ static PyMethodDef __pyx_methods[] = { {"set_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_37set_sample_rate, METH_O, 0}, {"set_amp_enable", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_39set_amp_enable, METH_O, 0}, {"set_baseband_filter_bandwidth", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_41set_baseband_filter_bandwidth, METH_O, 0}, + {"get_device_list", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6hackrf_43get_device_list, METH_NOARGS, 0}, {0, 0, 0, 0} }; @@ -19056,6 +19419,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_serial_number, __pyx_k_serial_number, sizeof(__pyx_k_serial_number), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, @@ -19079,7 +19443,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 29, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 132, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 147, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 150, __pyx_L1_error) @@ -19590,7 +19954,7 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d } -static int __pyx_pymod_exec_hackrf(PyObject *__pyx_pyinit_module) CYTHON_SMALL_CODE +static int __pyx_pymod_exec_hackrf(PyObject *__pyx_pyinit_module) #endif #endif { @@ -19695,49 +20059,49 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "urh/dev/native/lib/hackrf.pyx":4 - * import cython + /* "urh/dev/native/lib/hackrf.pyx":3 + * cimport chackrf * from libc.stdlib cimport malloc * import time # <<<<<<<<<<<<<< * * from urh.util.Logger import logger */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "urh/dev/native/lib/hackrf.pyx":6 + /* "urh/dev/native/lib/hackrf.pyx":5 * import time * * from urh.util.Logger import logger # <<<<<<<<<<<<<< * * TIMEOUT = 0.2 */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_logger); __Pyx_GIVEREF(__pyx_n_s_logger); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_logger); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_urh_util_Logger, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_urh_util_Logger, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "urh/dev/native/lib/hackrf.pyx":8 + /* "urh/dev/native/lib/hackrf.pyx":7 * from urh.util.Logger import logger * * TIMEOUT = 0.2 # <<<<<<<<<<<<<< * * cdef object f */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_TIMEOUT, __pyx_float_0_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TIMEOUT, __pyx_float_0_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - /* "urh/dev/native/lib/hackrf.pyx":11 + /* "urh/dev/native/lib/hackrf.pyx":10 * * cdef object f * cdef int RUNNING = 0 # <<<<<<<<<<<<<< @@ -19746,19 +20110,19 @@ if (!__Pyx_RefNanny) { */ __pyx_v_3urh_3dev_6native_3lib_6hackrf_RUNNING = 0; - /* "urh/dev/native/lib/hackrf.pyx":44 + /* "urh/dev/native/lib/hackrf.pyx":40 * * cdef chackrf.hackrf_device*_c_device * cdef int hackrf_success = chackrf.HACKRF_SUCCESS # <<<<<<<<<<<<<< * - * cpdef setup(): + * cpdef has_multi_device_support(): */ __pyx_v_3urh_3dev_6native_3lib_6hackrf_hackrf_success = HACKRF_SUCCESS; /* "urh/dev/native/lib/hackrf.pyx":1 * cimport chackrf # <<<<<<<<<<<<<< - * import cython * from libc.stdlib cimport malloc + * import time */ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -20611,63 +20975,25 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } } -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* RaiseArgTupleInvalid */ - static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) +/* ArgTypeTest */ + static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; } - if (exact) { - more_or_less = "exactly"; + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; } PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; } /* RaiseDoubleKeywords */ @@ -20786,25 +21112,63 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, return -1; } -/* ArgTypeTest */ - static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +/* RaiseArgTupleInvalid */ + static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; + if (exact) { + more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* decode_c_string */ + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + Py_ssize_t length; + if (unlikely((start < 0) | (stop < 0))) { + size_t slen = strlen(cstring); + if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, + "c-string too long to convert to Python"); + return NULL; + } + length = (Py_ssize_t) slen; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + length = stop - start; + if (unlikely(length <= 0)) + return PyUnicode_FromUnicode(NULL, 0); + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } } /* RaiseException */ diff --git a/src/urh/dev/native/lib/hackrf.pyx b/src/urh/dev/native/lib/hackrf.pyx index 3df6de0393..4aa129066d 100644 --- a/src/urh/dev/native/lib/hackrf.pyx +++ b/src/urh/dev/native/lib/hackrf.pyx @@ -1,5 +1,4 @@ cimport chackrf -import cython from libc.stdlib cimport malloc import time @@ -19,9 +18,6 @@ cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: logger.error("Cython-HackRF:" + str(e)) return -1 -@cython.boundscheck(False) -@cython.initializedcheck(False) -@cython.wraparound(False) cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) with gil: global f, RUNNING # tostring() is a compatibility (numpy<1.9) alias for tobytes(). Despite its name it returns bytes not strings. @@ -43,27 +39,31 @@ cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) with gil: cdef chackrf.hackrf_device*_c_device cdef int hackrf_success = chackrf.HACKRF_SUCCESS -cpdef setup(): +cpdef has_multi_device_support(): + return chackrf.HACKRF_HAS_MULTI_DEVICE != 0 + +cpdef setup(str serial): """ Convenience method for init + open. This one is used by HackRF class. :return: """ init() - return open() + return open(serial) cpdef init(): return chackrf.hackrf_init() -cpdef open(): - return chackrf.hackrf_open(&_c_device) +cpdef open(str serial_number=""): + if not chackrf.HACKRF_HAS_MULTI_DEVICE or not serial_number: + return chackrf.hackrf_open(&_c_device) + + desired_serial = serial_number.encode('UTF-8') + c_desired_serial = desired_serial + return chackrf.hackrf_open_by_serial(c_desired_serial, &_c_device) cpdef exit(): return chackrf.hackrf_exit() -cpdef reopen(): - close() - return open() - cpdef close(): return chackrf.hackrf_close(_c_device) @@ -152,3 +152,20 @@ cpdef set_amp_enable(value): cpdef set_baseband_filter_bandwidth(bandwidth_hz): time.sleep(TIMEOUT) return chackrf.hackrf_set_baseband_filter_bandwidth(_c_device, bandwidth_hz) + +cpdef get_device_list(): + if not chackrf.HACKRF_HAS_MULTI_DEVICE: + return None + + init() + cdef chackrf.hackrf_device_list_t* device_list = chackrf.hackrf_device_list() + + result = [] + cdef int i + for i in range(device_list.devicecount): + serial_number = device_list.serial_numbers[i].decode("UTF-8") + result.append(serial_number) + + chackrf.hackrf_device_list_free(device_list) + exit() + return result \ No newline at end of file diff --git a/src/urh/dev/native/lib/rtlsdr.cpp b/src/urh/dev/native/lib/rtlsdr.cpp index 4902ac6c0a..3bb4f0950d 100644 --- a/src/urh/dev/native/lib/rtlsdr.cpp +++ b/src/urh/dev/native/lib/rtlsdr.cpp @@ -1,9 +1,10 @@ -/* Generated by Cython 0.28 */ +/* Generated by Cython 0.28.2 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ + "/home/joe/GIT/urh/src/urh/dev/native/includes/config.h", "/home/joe/GIT/urh/src/urh/dev/native/includes/rtl-sdr.h" ], "extra_compile_args": [ @@ -32,7 +33,7 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_28" +#define CYTHON_ABI "0_28_2" #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -600,6 +601,7 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__urh__dev__native__lib__rtlsdr #define __PYX_HAVE_API__urh__dev__native__lib__rtlsdr /* Early includes */ +#include "config.h" #include "rtl-sdr.h" #include #include @@ -848,7 +850,7 @@ typedef unsigned PY_LONG_LONG __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint64_t; /*--- Type declarations ---*/ struct __pyx_opt_args_3urh_3dev_6native_3lib_6rtlsdr_read_sync; -/* "urh/dev/native/lib/rtlsdr.pyx":278 +/* "urh/dev/native/lib/rtlsdr.pyx":300 * return crtlsdr.rtlsdr_reset_buffer(_c_device) * * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< @@ -1034,12 +1036,65 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); @@ -1069,33 +1124,6 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1172,10 +1200,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'urh.dev.native.lib.rtlsdr' */ static rtlsdr_dev_t *__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device; static void __pyx_f_3urh_3dev_6native_3lib_6rtlsdr__c_callback_recv(unsigned char *, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t, void *); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_bandwidth_is_adjustable(int __pyx_skip_dispatch); /*proto*/ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t, int __pyx_skip_dispatch); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_list(int __pyx_skip_dispatch); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_open(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t, int __pyx_skip_dispatch); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_close(int __pyx_skip_dispatch); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_xtal_freq(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t, int __pyx_skip_dispatch); /*proto*/ @@ -1211,11 +1241,13 @@ int __pyx_module_is_main_urh__dev__native__lib__rtlsdr = 0; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_f[] = "f"; +static const char __pyx_k_SN[] = "{} {} (SN: {})"; static const char __pyx_k_gain[] = "gain"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_stage[] = "stage"; +static const char __pyx_k_format[] = "format"; static const char __pyx_k_callback[] = "callback"; static const char __pyx_k_rtl_freq[] = "rtl_freq"; static const char __pyx_k_connection[] = "connection"; @@ -1224,10 +1256,12 @@ static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_num_samples[] = "num_samples"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_kp_u_SN; static PyObject *__pyx_n_s_callback; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_connection; static PyObject *__pyx_n_s_f; +static PyObject *__pyx_n_s_format; static PyObject *__pyx_n_s_gain; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_num_samples; @@ -1236,37 +1270,39 @@ static PyObject *__pyx_n_s_rtl_freq; static PyObject *__pyx_n_s_stage; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_tuner_freq; -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_name(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_usb_strings(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_index_by_serial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8open(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10close(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16get_usb_strings(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_freq); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ppm); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gain); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_stage, int __pyx_v_gain); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_manual); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_bw); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_sample_rate); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54reset_buffer(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56read_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_num_samples); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58read_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_connection); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60cancel_async(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_bandwidth_is_adjustable(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_count(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_name(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_device_usb_strings(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8get_index_by_serial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10get_device_list(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12open(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14close(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16set_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18get_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_usb_strings(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_freq); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_center_freq(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26set_freq_correction(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ppm); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_freq_correction(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30get_tuner_type(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gains(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gain); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36get_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_if_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_stage, int __pyx_v_gain); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_tuner_gain_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_manual); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42set_tuner_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_bw); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_sample_rate); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46get_sample_rate(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48set_agc_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54set_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56get_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58reset_buffer(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60read_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_num_samples); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_62read_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_connection); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_64cancel_async(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static int __pyx_k__4; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; @@ -1389,18 +1425,129 @@ static void __pyx_f_3urh_3dev_6native_3lib_6rtlsdr__c_callback_recv(unsigned cha /* "urh/dev/native/lib/rtlsdr.pyx":19 * * + * cpdef bandwidth_is_adjustable(): # <<<<<<<<<<<<<< + * if crtlsdr.RTLSDR_HAS_BANDWIDTH: + * return True + */ + +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1bandwidth_is_adjustable(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_bandwidth_is_adjustable(CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("bandwidth_is_adjustable", 0); + + /* "urh/dev/native/lib/rtlsdr.pyx":20 + * + * cpdef bandwidth_is_adjustable(): + * if crtlsdr.RTLSDR_HAS_BANDWIDTH: # <<<<<<<<<<<<<< + * return True + * else: + */ + __pyx_t_1 = (RTLSDR_HAS_BANDWIDTH != 0); + if (__pyx_t_1) { + + /* "urh/dev/native/lib/rtlsdr.pyx":21 + * cpdef bandwidth_is_adjustable(): + * if crtlsdr.RTLSDR_HAS_BANDWIDTH: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + + /* "urh/dev/native/lib/rtlsdr.pyx":20 + * + * cpdef bandwidth_is_adjustable(): + * if crtlsdr.RTLSDR_HAS_BANDWIDTH: # <<<<<<<<<<<<<< + * return True + * else: + */ + } + + /* "urh/dev/native/lib/rtlsdr.pyx":23 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * cpdef uint32_t get_device_count(): + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + + /* "urh/dev/native/lib/rtlsdr.pyx":19 + * + * + * cpdef bandwidth_is_adjustable(): # <<<<<<<<<<<<<< + * if crtlsdr.RTLSDR_HAS_BANDWIDTH: + * return True + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1bandwidth_is_adjustable(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1bandwidth_is_adjustable(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("bandwidth_is_adjustable (wrapper)", 0); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_bandwidth_is_adjustable(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_bandwidth_is_adjustable(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("bandwidth_is_adjustable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_bandwidth_is_adjustable(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.bandwidth_is_adjustable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "urh/dev/native/lib/rtlsdr.pyx":25 + * return False + * * cpdef uint32_t get_device_count(): # <<<<<<<<<<<<<< * return crtlsdr.rtlsdr_get_device_count() * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_device_count", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":20 + /* "urh/dev/native/lib/rtlsdr.pyx":26 * * cpdef uint32_t get_device_count(): * return crtlsdr.rtlsdr_get_device_count() # <<<<<<<<<<<<<< @@ -1410,8 +1557,8 @@ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native __pyx_r = rtlsdr_get_device_count(); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":19 - * + /* "urh/dev/native/lib/rtlsdr.pyx":25 + * return False * * cpdef uint32_t get_device_count(): # <<<<<<<<<<<<<< * return crtlsdr.rtlsdr_get_device_count() @@ -1425,25 +1572,25 @@ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_device_count (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_count(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_count(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_device_count", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1460,7 +1607,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(CYTHON return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":22 +/* "urh/dev/native/lib/rtlsdr.pyx":28 * return crtlsdr.rtlsdr_get_device_count() * * cpdef str get_device_name(uint32_t index): # <<<<<<<<<<<<<< @@ -1468,7 +1615,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(CYTHON * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -1476,7 +1623,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_t_ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("get_device_name", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":23 + /* "urh/dev/native/lib/rtlsdr.pyx":29 * * cpdef str get_device_name(uint32_t index): * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') # <<<<<<<<<<<<<< @@ -1485,15 +1632,15 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_t_ */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = rtlsdr_get_device_name(__pyx_v_index); - __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 23, __pyx_L1_error) + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_INCREF(__pyx_t_2); __pyx_r = ((PyObject*)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":22 + /* "urh/dev/native/lib/rtlsdr.pyx":28 * return crtlsdr.rtlsdr_get_device_count() * * cpdef str get_device_name(uint32_t index): # <<<<<<<<<<<<<< @@ -1513,14 +1660,14 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_t_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_device_name (wrapper)", 0); assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L3_error) + __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -1528,20 +1675,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_name(PyObje __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_name(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_index)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_name(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_name(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_name(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_device_name", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_name(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1558,7 +1705,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_name(CYTHON return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":25 +/* "urh/dev/native/lib/rtlsdr.pyx":31 * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') * * cpdef tuple get_device_usb_strings(uint32_t index): # <<<<<<<<<<<<<< @@ -1566,7 +1713,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_2get_device_name(CYTHON * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { char *__pyx_v_manufacturer; char *__pyx_v_product; @@ -1579,9 +1726,19 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(_ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + char const *__pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; __Pyx_RefNannySetupContext("get_device_usb_strings", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":31 + /* "urh/dev/native/lib/rtlsdr.pyx":37 * :return: manufacturer name, product name, serial serial number on success else None, None, None * """ * cdef char *manufacturer = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< @@ -1590,7 +1747,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(_ */ __pyx_v_manufacturer = ((char *)malloc((0x100 * (sizeof(char))))); - /* "urh/dev/native/lib/rtlsdr.pyx":32 + /* "urh/dev/native/lib/rtlsdr.pyx":38 * """ * cdef char *manufacturer = malloc(256 * sizeof(char)) * cdef char *product = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< @@ -1599,87 +1756,194 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(_ */ __pyx_v_product = ((char *)malloc((0x100 * (sizeof(char))))); - /* "urh/dev/native/lib/rtlsdr.pyx":33 + /* "urh/dev/native/lib/rtlsdr.pyx":39 * cdef char *manufacturer = malloc(256 * sizeof(char)) * cdef char *product = malloc(256 * sizeof(char)) * cdef char *serial = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: + * try: */ __pyx_v_serial = ((char *)malloc((0x100 * (sizeof(char))))); - /* "urh/dev/native/lib/rtlsdr.pyx":34 + /* "urh/dev/native/lib/rtlsdr.pyx":40 * cdef char *product = malloc(256 * sizeof(char)) * cdef char *serial = malloc(256 * sizeof(char)) * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) # <<<<<<<<<<<<<< - * if result == 0: - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') + * try: + * if result == 0: */ __pyx_v_result = rtlsdr_get_device_usb_strings(__pyx_v_index, __pyx_v_manufacturer, __pyx_v_product, __pyx_v_serial); - /* "urh/dev/native/lib/rtlsdr.pyx":35 + /* "urh/dev/native/lib/rtlsdr.pyx":41 * cdef char *serial = malloc(256 * sizeof(char)) * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: # <<<<<<<<<<<<<< - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: + * try: # <<<<<<<<<<<<<< + * if result == 0: + * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') */ - __pyx_t_1 = ((__pyx_v_result == 0) != 0); - if (__pyx_t_1) { + /*try:*/ { - /* "urh/dev/native/lib/rtlsdr.pyx":36 + /* "urh/dev/native/lib/rtlsdr.pyx":42 * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') # <<<<<<<<<<<<<< - * else: - * return None, None, None + * try: + * if result == 0: # <<<<<<<<<<<<<< + * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_manufacturer, 0, strlen(__pyx_v_manufacturer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_product, 0, strlen(__pyx_v_product), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_serial, 0, strlen(__pyx_v_serial), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_1 = ((__pyx_v_result == 0) != 0); + if (__pyx_t_1) { - /* "urh/dev/native/lib/rtlsdr.pyx":35 - * cdef char *serial = malloc(256 * sizeof(char)) + /* "urh/dev/native/lib/rtlsdr.pyx":43 + * try: + * if result == 0: + * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') # <<<<<<<<<<<<<< + * else: + * return None, None, None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_manufacturer, 0, strlen(__pyx_v_manufacturer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_product, 0, strlen(__pyx_v_product), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_serial, 0, strlen(__pyx_v_serial), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_r = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L3_return; + + /* "urh/dev/native/lib/rtlsdr.pyx":42 * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: # <<<<<<<<<<<<<< - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: + * try: + * if result == 0: # <<<<<<<<<<<<<< + * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') + * else: + */ + } + + /* "urh/dev/native/lib/rtlsdr.pyx":45 + * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') + * else: + * return None, None, None # <<<<<<<<<<<<<< + * finally: + * free(manufacturer) */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_tuple_); + __pyx_r = __pyx_tuple_; + goto __pyx_L3_return; + } } - /* "urh/dev/native/lib/rtlsdr.pyx":38 - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - * return None, None, None # <<<<<<<<<<<<<< + /* "urh/dev/native/lib/rtlsdr.pyx":47 + * return None, None, None + * finally: + * free(manufacturer) # <<<<<<<<<<<<<< + * free(product) + * free(serial) + */ + /*finally:*/ { + __pyx_L4_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename; + { + free(__pyx_v_manufacturer); + + /* "urh/dev/native/lib/rtlsdr.pyx":48 + * finally: + * free(manufacturer) + * free(product) # <<<<<<<<<<<<<< + * free(serial) + * + */ + free(__pyx_v_product); + + /* "urh/dev/native/lib/rtlsdr.pyx":49 + * free(manufacturer) + * free(product) + * free(serial) # <<<<<<<<<<<<<< * * cpdef int get_index_by_serial(str serial): */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_tuple_); - __pyx_r = __pyx_tuple_; - goto __pyx_L0; + free(__pyx_v_serial); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8; + goto __pyx_L1_error; + } + __pyx_L3_return: { + __pyx_t_15 = __pyx_r; + __pyx_r = 0; + + /* "urh/dev/native/lib/rtlsdr.pyx":47 + * return None, None, None + * finally: + * free(manufacturer) # <<<<<<<<<<<<<< + * free(product) + * free(serial) + */ + free(__pyx_v_manufacturer); + + /* "urh/dev/native/lib/rtlsdr.pyx":48 + * finally: + * free(manufacturer) + * free(product) # <<<<<<<<<<<<<< + * free(serial) + * + */ + free(__pyx_v_product); + + /* "urh/dev/native/lib/rtlsdr.pyx":49 + * free(manufacturer) + * free(product) + * free(serial) # <<<<<<<<<<<<<< + * + * cpdef int get_index_by_serial(str serial): + */ + free(__pyx_v_serial); + __pyx_r = __pyx_t_15; + __pyx_t_15 = 0; + goto __pyx_L0; + } } - /* "urh/dev/native/lib/rtlsdr.pyx":25 + /* "urh/dev/native/lib/rtlsdr.pyx":31 * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') * * cpdef tuple get_device_usb_strings(uint32_t index): # <<<<<<<<<<<<<< @@ -1702,15 +1966,15 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_4get_device_usb_strings[] = "\n\n :param index: index of the device\n :return: manufacturer name, product name, serial serial number on success else None, None, None\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_6get_device_usb_strings[] = "\n\n :param index: index of the device\n :return: manufacturer name, product name, serial serial number on success else None, None, None\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_device_usb_strings (wrapper)", 0); assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) + __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -1718,20 +1982,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_usb_strings __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_usb_strings(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_index)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_device_usb_strings(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_usb_strings(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_device_usb_strings(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_device_usb_strings", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1748,15 +2012,15 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_4get_device_usb_strings return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":40 - * return None, None, None +/* "urh/dev/native/lib/rtlsdr.pyx":51 + * free(serial) * * cpdef int get_index_by_serial(str serial): # <<<<<<<<<<<<<< * """ * Get device index by USB serial string descriptor. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(PyObject *__pyx_v_serial, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_v_serial_byte_string = NULL; int __pyx_r; @@ -1765,7 +2029,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(PyObject * char *__pyx_t_2; __Pyx_RefNannySetupContext("get_index_by_serial", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":50 + /* "urh/dev/native/lib/rtlsdr.pyx":61 * -3 if devices were found, but none with matching name * """ * serial_byte_string = serial.encode('UTF-8') # <<<<<<<<<<<<<< @@ -1774,26 +2038,26 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(PyObject * */ if (unlikely(__pyx_v_serial == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 50, __pyx_L1_error) + __PYX_ERR(0, 61, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_serial); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_serial); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_serial_byte_string = __pyx_t_1; __pyx_t_1 = 0; - /* "urh/dev/native/lib/rtlsdr.pyx":51 + /* "urh/dev/native/lib/rtlsdr.pyx":62 * """ * serial_byte_string = serial.encode('UTF-8') * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) # <<<<<<<<<<<<<< * - * cpdef int open(uint32_t index): + * cpdef list get_device_list(): */ - __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_serial_byte_string); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_serial_byte_string); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L1_error) __pyx_r = rtlsdr_get_index_by_serial(((char *)__pyx_t_2)); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":40 - * return None, None, None + /* "urh/dev/native/lib/rtlsdr.pyx":51 + * free(serial) * * cpdef int get_index_by_serial(str serial): # <<<<<<<<<<<<<< * """ @@ -1812,14 +2076,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(PyObject * } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_6get_index_by_serial[] = "\n Get device index by USB serial string descriptor.\n\n :param serial: serial string of the device\n :return: device index of first device where the name matched\n -1 if name is NULL\n -2 if no devices were found at all\n -3 if devices were found, but none with matching name\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_8get_index_by_serial[] = "\n Get device index by USB serial string descriptor.\n\n :param serial: serial string of the device\n :return: device index of first device where the name matched\n -1 if name is NULL\n -2 if no devices were found at all\n -3 if devices were found, but none with matching name\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_index_by_serial (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_serial), (&PyUnicode_Type), 1, "serial", 1))) __PYX_ERR(0, 40, __pyx_L1_error) - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_index_by_serial(__pyx_self, ((PyObject*)__pyx_v_serial)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_serial), (&PyUnicode_Type), 1, "serial", 1))) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8get_index_by_serial(__pyx_self, ((PyObject*)__pyx_v_serial)); /* function exit code */ goto __pyx_L0; @@ -1830,13 +2094,13 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_index_by_serial(Py return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_index_by_serial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8get_index_by_serial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_index_by_serial", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(__pyx_v_serial, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_index_by_serial(__pyx_v_serial, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1853,21 +2117,261 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_6get_index_by_serial(CY return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":53 +/* "urh/dev/native/lib/rtlsdr.pyx":64 + * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) + * + * cpdef list get_device_list(): # <<<<<<<<<<<<<< + * result = [] + * cdef uint32_t i, n = get_device_count() + */ + +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11get_device_list(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_list(CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_result = NULL; + __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_i; + __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_n; + PyObject *__pyx_v_manufacturer = NULL; + PyObject *__pyx_v_product = NULL; + PyObject *__pyx_v_serial = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_t_2; + __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_t_3; + __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + __Pyx_RefNannySetupContext("get_device_list", 0); + + /* "urh/dev/native/lib/rtlsdr.pyx":65 + * + * cpdef list get_device_list(): + * result = [] # <<<<<<<<<<<<<< + * cdef uint32_t i, n = get_device_count() + * for i in range(n): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "urh/dev/native/lib/rtlsdr.pyx":66 + * cpdef list get_device_list(): + * result = [] + * cdef uint32_t i, n = get_device_count() # <<<<<<<<<<<<<< + * for i in range(n): + * manufacturer, product, serial = get_device_usb_strings(i) + */ + __pyx_v_n = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_count(0); + + /* "urh/dev/native/lib/rtlsdr.pyx":67 + * result = [] + * cdef uint32_t i, n = get_device_count() + * for i in range(n): # <<<<<<<<<<<<<< + * manufacturer, product, serial = get_device_usb_strings(i) + * result.append("{} {} (SN: {})".format(manufacturer, product, serial)) + */ + __pyx_t_2 = __pyx_v_n; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "urh/dev/native/lib/rtlsdr.pyx":68 + * cdef uint32_t i, n = get_device_count() + * for i in range(n): + * manufacturer, product, serial = get_device_usb_strings(i) # <<<<<<<<<<<<<< + * result.append("{} {} (SN: {})".format(manufacturer, product, serial)) + * return result + */ + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_usb_strings(__pyx_v_i, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 68, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 68, __pyx_L1_error) + } + __Pyx_XDECREF_SET(__pyx_v_manufacturer, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_product, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_serial, __pyx_t_7); + __pyx_t_7 = 0; + + /* "urh/dev/native/lib/rtlsdr.pyx":69 + * for i in range(n): + * manufacturer, product, serial = get_device_usb_strings(i) + * result.append("{} {} (SN: {})".format(manufacturer, product, serial)) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_SN, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_manufacturer, __pyx_v_product, __pyx_v_serial}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_manufacturer, __pyx_v_product, __pyx_v_serial}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_INCREF(__pyx_v_manufacturer); + __Pyx_GIVEREF(__pyx_v_manufacturer); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_v_manufacturer); + __Pyx_INCREF(__pyx_v_product); + __Pyx_GIVEREF(__pyx_v_product); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_v_product); + __Pyx_INCREF(__pyx_v_serial); + __Pyx_GIVEREF(__pyx_v_serial); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_8, __pyx_v_serial); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "urh/dev/native/lib/rtlsdr.pyx":70 + * manufacturer, product, serial = get_device_usb_strings(i) + * result.append("{} {} (SN: {})".format(manufacturer, product, serial)) + * return result # <<<<<<<<<<<<<< + * + * cpdef int open(uint32_t index): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "urh/dev/native/lib/rtlsdr.pyx":64 * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) * + * cpdef list get_device_list(): # <<<<<<<<<<<<<< + * result = [] + * cdef uint32_t i, n = get_device_count() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.get_device_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_manufacturer); + __Pyx_XDECREF(__pyx_v_product); + __Pyx_XDECREF(__pyx_v_serial); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11get_device_list(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11get_device_list(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_device_list (wrapper)", 0); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10get_device_list(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10get_device_list(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_device_list", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_device_list(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.get_device_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "urh/dev/native/lib/rtlsdr.pyx":72 + * return result + * * cpdef int open(uint32_t index): # <<<<<<<<<<<<<< * return crtlsdr.rtlsdr_open(&_c_device, index) * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9open(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13open(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_open(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("open", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":54 + /* "urh/dev/native/lib/rtlsdr.pyx":73 * * cpdef int open(uint32_t index): * return crtlsdr.rtlsdr_open(&_c_device, index) # <<<<<<<<<<<<<< @@ -1877,8 +2381,8 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_open(__pyx_t_3urh_3dev_6native __pyx_r = rtlsdr_open((&__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device), __pyx_v_index); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":53 - * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) + /* "urh/dev/native/lib/rtlsdr.pyx":72 + * return result * * cpdef int open(uint32_t index): # <<<<<<<<<<<<<< * return crtlsdr.rtlsdr_open(&_c_device, index) @@ -1892,14 +2396,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_open(__pyx_t_3urh_3dev_6native } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9open(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9open(PyObject *__pyx_self, PyObject *__pyx_arg_index) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13open(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13open(PyObject *__pyx_self, PyObject *__pyx_arg_index) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("open (wrapper)", 0); assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error) + __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -1907,20 +2411,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9open(PyObject *__pyx_s __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8open(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_index)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12open(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8open(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12open(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_index) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("open", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_open(__pyx_v_index, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_open(__pyx_v_index, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1937,7 +2441,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8open(CYTHON_UNUSED PyO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":56 +/* "urh/dev/native/lib/rtlsdr.pyx":75 * return crtlsdr.rtlsdr_open(&_c_device, index) * * cpdef int close(): # <<<<<<<<<<<<<< @@ -1945,13 +2449,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_8open(CYTHON_UNUSED PyO * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_close(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":57 + /* "urh/dev/native/lib/rtlsdr.pyx":76 * * cpdef int close(): * return crtlsdr.rtlsdr_close(_c_device) # <<<<<<<<<<<<<< @@ -1961,7 +2465,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_close(CYTHON_UNUSED int __pyx_ __pyx_r = rtlsdr_close(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":56 + /* "urh/dev/native/lib/rtlsdr.pyx":75 * return crtlsdr.rtlsdr_open(&_c_device, index) * * cpdef int close(): # <<<<<<<<<<<<<< @@ -1976,25 +2480,25 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_close(CYTHON_UNUSED int __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10close(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14close(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10close(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14close(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("close", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_close(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_close(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2011,7 +2515,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10close(CYTHON_UNUSED P return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":59 +/* "urh/dev/native/lib/rtlsdr.pyx":78 * return crtlsdr.rtlsdr_close(_c_device) * * cpdef int set_xtal_freq(uint32_t rtl_freq, uint32_t tuner_freq): # <<<<<<<<<<<<<< @@ -2019,13 +2523,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_10close(CYTHON_UNUSED P * Set crystal oscillator frequencies used for the RTL2832 and the tuner IC. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_xtal_freq(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_xtal_freq", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":73 + /* "urh/dev/native/lib/rtlsdr.pyx":92 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) # <<<<<<<<<<<<<< @@ -2035,7 +2539,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_xtal_freq(__pyx_t_3urh_3de __pyx_r = rtlsdr_set_xtal_freq(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_rtl_freq, __pyx_v_tuner_freq); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":59 + /* "urh/dev/native/lib/rtlsdr.pyx":78 * return crtlsdr.rtlsdr_close(_c_device) * * cpdef int set_xtal_freq(uint32_t rtl_freq, uint32_t tuner_freq): # <<<<<<<<<<<<<< @@ -2050,9 +2554,9 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_xtal_freq(__pyx_t_3urh_3de } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq[] = "\n Set crystal oscillator frequencies used for the RTL2832 and the tuner IC.\n\n Usually both ICs use the same clock. Changing the clock may make sense if\n you are applying an external clock to the tuner or to compensate the\n frequency (and samplerate) error caused by the original (cheap) crystal.\n\n NOTE: Call this function only if you fully understand the implications.\n\n :param rtl_freq: frequency value used to clock the RTL2832 in Hz\n :param tuner_freq: frequency value used to clock the tuner IC in Hz\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_16set_xtal_freq[] = "\n Set crystal oscillator frequencies used for the RTL2832 and the tuner IC.\n\n Usually both ICs use the same clock. Changing the clock may make sense if\n you are applying an external clock to the tuner or to compensate the\n frequency (and samplerate) error caused by the original (cheap) crystal.\n\n NOTE: Call this function only if you fully understand the implications.\n\n :param rtl_freq: frequency value used to clock the RTL2832 in Hz\n :param tuner_freq: frequency value used to clock the tuner IC in Hz\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq; __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq; PyObject *__pyx_r = 0; @@ -2081,11 +2585,11 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13set_xtal_freq(PyObjec case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tuner_freq)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_xtal_freq", 1, 2, 2, 1); __PYX_ERR(0, 59, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_xtal_freq", 1, 2, 2, 1); __PYX_ERR(0, 78, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_xtal_freq") < 0)) __PYX_ERR(0, 59, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_xtal_freq") < 0)) __PYX_ERR(0, 78, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2093,31 +2597,31 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13set_xtal_freq(PyObjec values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_rtl_freq = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_rtl_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) - __pyx_v_tuner_freq = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_tuner_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_rtl_freq = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_rtl_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) + __pyx_v_tuner_freq = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_tuner_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_xtal_freq", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 59, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_xtal_freq", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 78, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.set_xtal_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq(__pyx_self, __pyx_v_rtl_freq, __pyx_v_tuner_freq); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16set_xtal_freq(__pyx_self, __pyx_v_rtl_freq, __pyx_v_tuner_freq); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16set_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_xtal_freq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_xtal_freq(__pyx_v_rtl_freq, __pyx_v_tuner_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_xtal_freq(__pyx_v_rtl_freq, __pyx_v_tuner_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2134,7 +2638,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq(CYTHON_ return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":75 +/* "urh/dev/native/lib/rtlsdr.pyx":94 * return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) * * cpdef tuple get_xtal_freq(): # <<<<<<<<<<<<<< @@ -2142,7 +2646,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq(CYTHON_ * Get crystal oscillator frequencies used for the RTL2832 and the tuner IC. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_rtl_freq; __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_tuner_freq; @@ -2155,7 +2659,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("get_xtal_freq", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":83 + /* "urh/dev/native/lib/rtlsdr.pyx":102 * tuner_freq frequency value used to clock the tuner IC in Hz * """ * cdef uint32_t rtl_freq = 0 # <<<<<<<<<<<<<< @@ -2164,7 +2668,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU */ __pyx_v_rtl_freq = 0; - /* "urh/dev/native/lib/rtlsdr.pyx":84 + /* "urh/dev/native/lib/rtlsdr.pyx":103 * """ * cdef uint32_t rtl_freq = 0 * cdef uint32_t tuner_freq = 0 # <<<<<<<<<<<<<< @@ -2173,7 +2677,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU */ __pyx_v_tuner_freq = 0; - /* "urh/dev/native/lib/rtlsdr.pyx":85 + /* "urh/dev/native/lib/rtlsdr.pyx":104 * cdef uint32_t rtl_freq = 0 * cdef uint32_t tuner_freq = 0 * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) # <<<<<<<<<<<<<< @@ -2182,7 +2686,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU */ __pyx_v_result = rtlsdr_get_xtal_freq(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, (&__pyx_v_rtl_freq), (&__pyx_v_tuner_freq)); - /* "urh/dev/native/lib/rtlsdr.pyx":87 + /* "urh/dev/native/lib/rtlsdr.pyx":106 * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) * * if result == 0: # <<<<<<<<<<<<<< @@ -2192,7 +2696,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU __pyx_t_1 = ((__pyx_v_result == 0) != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/rtlsdr.pyx":88 + /* "urh/dev/native/lib/rtlsdr.pyx":107 * * if result == 0: * return rtl_freq, tuner_freq # <<<<<<<<<<<<<< @@ -2200,11 +2704,11 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU * return None, None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_rtl_freq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_rtl_freq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_tuner_freq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_tuner_freq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); @@ -2216,7 +2720,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU __pyx_t_4 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":87 + /* "urh/dev/native/lib/rtlsdr.pyx":106 * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) * * if result == 0: # <<<<<<<<<<<<<< @@ -2225,7 +2729,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU */ } - /* "urh/dev/native/lib/rtlsdr.pyx":90 + /* "urh/dev/native/lib/rtlsdr.pyx":109 * return rtl_freq, tuner_freq * else: * return None, None # <<<<<<<<<<<<<< @@ -2239,7 +2743,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU goto __pyx_L0; } - /* "urh/dev/native/lib/rtlsdr.pyx":75 + /* "urh/dev/native/lib/rtlsdr.pyx":94 * return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) * * cpdef tuple get_xtal_freq(): # <<<<<<<<<<<<<< @@ -2261,26 +2765,26 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(CYTHON_UNU } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq[] = "\n Get crystal oscillator frequencies used for the RTL2832 and the tuner IC.\n Usually both ICs use the same clock.\n\n :return: rtl_freq frequency value used to clock the RTL2832 in Hz,\n tuner_freq frequency value used to clock the tuner IC in Hz\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_18get_xtal_freq[] = "\n Get crystal oscillator frequencies used for the RTL2832 and the tuner IC.\n Usually both ICs use the same clock.\n\n :return: rtl_freq frequency value used to clock the RTL2832 in Hz,\n tuner_freq frequency value used to clock the tuner IC in Hz\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_xtal_freq (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18get_xtal_freq(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18get_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_xtal_freq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_xtal_freq(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2297,7 +2801,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq(CYTHON_ return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":92 +/* "urh/dev/native/lib/rtlsdr.pyx":111 * return None, None * * cpdef tuple get_usb_strings(): # <<<<<<<<<<<<<< @@ -2305,7 +2809,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq(CYTHON_ * cdef char *product = malloc(256 * sizeof(char)) */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_UNUSED int __pyx_skip_dispatch) { char *__pyx_v_manufacturer; char *__pyx_v_product; @@ -2320,7 +2824,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("get_usb_strings", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":93 + /* "urh/dev/native/lib/rtlsdr.pyx":112 * * cpdef tuple get_usb_strings(): * cdef char *manufacturer = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< @@ -2329,7 +2833,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U */ __pyx_v_manufacturer = ((char *)malloc((0x100 * (sizeof(char))))); - /* "urh/dev/native/lib/rtlsdr.pyx":94 + /* "urh/dev/native/lib/rtlsdr.pyx":113 * cpdef tuple get_usb_strings(): * cdef char *manufacturer = malloc(256 * sizeof(char)) * cdef char *product = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< @@ -2338,7 +2842,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U */ __pyx_v_product = ((char *)malloc((0x100 * (sizeof(char))))); - /* "urh/dev/native/lib/rtlsdr.pyx":95 + /* "urh/dev/native/lib/rtlsdr.pyx":114 * cdef char *manufacturer = malloc(256 * sizeof(char)) * cdef char *product = malloc(256 * sizeof(char)) * cdef char *serial = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< @@ -2347,7 +2851,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U */ __pyx_v_serial = ((char *)malloc((0x100 * (sizeof(char))))); - /* "urh/dev/native/lib/rtlsdr.pyx":96 + /* "urh/dev/native/lib/rtlsdr.pyx":115 * cdef char *product = malloc(256 * sizeof(char)) * cdef char *serial = malloc(256 * sizeof(char)) * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) # <<<<<<<<<<<<<< @@ -2356,7 +2860,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U */ __pyx_v_result = rtlsdr_get_usb_strings(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_manufacturer, __pyx_v_product, __pyx_v_serial); - /* "urh/dev/native/lib/rtlsdr.pyx":97 + /* "urh/dev/native/lib/rtlsdr.pyx":116 * cdef char *serial = malloc(256 * sizeof(char)) * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) * if result == 0: # <<<<<<<<<<<<<< @@ -2366,7 +2870,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U __pyx_t_1 = ((__pyx_v_result == 0) != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/rtlsdr.pyx":98 + /* "urh/dev/native/lib/rtlsdr.pyx":117 * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) * if result == 0: * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') # <<<<<<<<<<<<<< @@ -2374,13 +2878,13 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U * return None, None, None */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_manufacturer, 0, strlen(__pyx_v_manufacturer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_manufacturer, 0, strlen(__pyx_v_manufacturer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_product, 0, strlen(__pyx_v_product), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_product, 0, strlen(__pyx_v_product), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_serial, 0, strlen(__pyx_v_serial), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_serial, 0, strlen(__pyx_v_serial), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); @@ -2395,7 +2899,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U __pyx_t_5 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":97 + /* "urh/dev/native/lib/rtlsdr.pyx":116 * cdef char *serial = malloc(256 * sizeof(char)) * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) * if result == 0: # <<<<<<<<<<<<<< @@ -2404,7 +2908,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U */ } - /* "urh/dev/native/lib/rtlsdr.pyx":100 + /* "urh/dev/native/lib/rtlsdr.pyx":119 * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') * else: * return None, None, None # <<<<<<<<<<<<<< @@ -2418,7 +2922,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U goto __pyx_L0; } - /* "urh/dev/native/lib/rtlsdr.pyx":92 + /* "urh/dev/native/lib/rtlsdr.pyx":111 * return None, None * * cpdef tuple get_usb_strings(): # <<<<<<<<<<<<<< @@ -2441,25 +2945,25 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(CYTHON_U } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_usb_strings (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16get_usb_strings(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_usb_strings(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16get_usb_strings(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_usb_strings(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_usb_strings", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_usb_strings(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2476,7 +2980,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16get_usb_strings(CYTHO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":102 +/* "urh/dev/native/lib/rtlsdr.pyx":121 * return None, None, None * * cpdef int set_center_freq(uint32_t freq): # <<<<<<<<<<<<<< @@ -2484,13 +2988,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_16get_usb_strings(CYTHO * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_center_freq(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_freq, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_center_freq", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":103 + /* "urh/dev/native/lib/rtlsdr.pyx":122 * * cpdef int set_center_freq(uint32_t freq): * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) # <<<<<<<<<<<<<< @@ -2500,7 +3004,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_center_freq(__pyx_t_3urh_3 __pyx_r = rtlsdr_set_center_freq(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_freq); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":102 + /* "urh/dev/native/lib/rtlsdr.pyx":121 * return None, None, None * * cpdef int set_center_freq(uint32_t freq): # <<<<<<<<<<<<<< @@ -2515,14 +3019,14 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_center_freq(__pyx_t_3urh_3 } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_freq; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_center_freq (wrapper)", 0); assert(__pyx_arg_freq); { - __pyx_v_freq = __Pyx_PyInt_As_unsigned_int(__pyx_arg_freq); if (unlikely((__pyx_v_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) + __pyx_v_freq = __Pyx_PyInt_As_unsigned_int(__pyx_arg_freq); if (unlikely((__pyx_v_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2530,20 +3034,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19set_center_freq(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18set_center_freq(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_freq)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_center_freq(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_freq)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_freq) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_freq) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_center_freq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_center_freq(__pyx_v_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_center_freq(__pyx_v_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2560,7 +3064,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18set_center_freq(CYTHO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":105 +/* "urh/dev/native/lib/rtlsdr.pyx":124 * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) * * cpdef uint32_t get_center_freq(): # <<<<<<<<<<<<<< @@ -2568,13 +3072,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_18set_center_freq(CYTHO * Get actual frequency the device is tuned to. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_center_freq(CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_center_freq", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":111 + /* "urh/dev/native/lib/rtlsdr.pyx":130 * :return: 0 on error, frequency in Hz otherwise * """ * return crtlsdr.rtlsdr_get_center_freq(_c_device) # <<<<<<<<<<<<<< @@ -2584,7 +3088,7 @@ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native __pyx_r = rtlsdr_get_center_freq(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":105 + /* "urh/dev/native/lib/rtlsdr.pyx":124 * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) * * cpdef uint32_t get_center_freq(): # <<<<<<<<<<<<<< @@ -2599,26 +3103,26 @@ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq[] = "\n Get actual frequency the device is tuned to.\n\n :return: 0 on error, frequency in Hz otherwise\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_24get_center_freq[] = "\n Get actual frequency the device is tuned to.\n\n :return: 0 on error, frequency in Hz otherwise\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_center_freq (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_center_freq(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_center_freq(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_center_freq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_center_freq(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_center_freq(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2635,7 +3139,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq(CYTHO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":113 +/* "urh/dev/native/lib/rtlsdr.pyx":132 * return crtlsdr.rtlsdr_get_center_freq(_c_device) * * cpdef int set_freq_correction(int ppm): # <<<<<<<<<<<<<< @@ -2643,13 +3147,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq(CYTHO * Set the frequency correction value for the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_freq_correction(int __pyx_v_ppm, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_freq_correction", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":120 + /* "urh/dev/native/lib/rtlsdr.pyx":139 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) # <<<<<<<<<<<<<< @@ -2659,7 +3163,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_freq_correction(int __pyx_ __pyx_r = rtlsdr_set_freq_correction(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_ppm); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":113 + /* "urh/dev/native/lib/rtlsdr.pyx":132 * return crtlsdr.rtlsdr_get_center_freq(_c_device) * * cpdef int set_freq_correction(int ppm): # <<<<<<<<<<<<<< @@ -2674,15 +3178,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_freq_correction(int __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction[] = "\n Set the frequency correction value for the device.\n\n :param ppm: ppm correction value in parts per million (ppm)\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_26set_freq_correction[] = "\n Set the frequency correction value for the device.\n\n :param ppm: ppm correction value in parts per million (ppm)\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm) { int __pyx_v_ppm; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_freq_correction (wrapper)", 0); assert(__pyx_arg_ppm); { - __pyx_v_ppm = __Pyx_PyInt_As_int(__pyx_arg_ppm); if (unlikely((__pyx_v_ppm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) + __pyx_v_ppm = __Pyx_PyInt_As_int(__pyx_arg_ppm); if (unlikely((__pyx_v_ppm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2690,20 +3194,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_freq_correction(P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction(__pyx_self, ((int)__pyx_v_ppm)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26set_freq_correction(__pyx_self, ((int)__pyx_v_ppm)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ppm) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26set_freq_correction(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ppm) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_freq_correction", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_freq_correction(__pyx_v_ppm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_freq_correction(__pyx_v_ppm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2720,7 +3224,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction(C return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":122 +/* "urh/dev/native/lib/rtlsdr.pyx":141 * return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) * * cpdef int get_freq_correction(): # <<<<<<<<<<<<<< @@ -2728,13 +3232,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction(C * Get actual frequency correction value of the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_freq_correction(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_freq_correction", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":128 + /* "urh/dev/native/lib/rtlsdr.pyx":147 * :return: correction value in parts per million (ppm) * """ * return crtlsdr.rtlsdr_get_freq_correction(_c_device) # <<<<<<<<<<<<<< @@ -2744,7 +3248,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_freq_correction(CYTHON_UNU __pyx_r = rtlsdr_get_freq_correction(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":122 + /* "urh/dev/native/lib/rtlsdr.pyx":141 * return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) * * cpdef int get_freq_correction(): # <<<<<<<<<<<<<< @@ -2759,26 +3263,26 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_freq_correction(CYTHON_UNU } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction[] = "\n Get actual frequency correction value of the device.\n\n :return: correction value in parts per million (ppm)\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_28get_freq_correction[] = "\n Get actual frequency correction value of the device.\n\n :return: correction value in parts per million (ppm)\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_freq_correction (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_freq_correction(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_freq_correction(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_freq_correction", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_freq_correction(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_freq_correction(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2795,7 +3299,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction(C return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":130 +/* "urh/dev/native/lib/rtlsdr.pyx":149 * return crtlsdr.rtlsdr_get_freq_correction(_c_device) * * cpdef crtlsdr.rtlsdr_tuner get_tuner_type(): # <<<<<<<<<<<<<< @@ -2803,13 +3307,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction(C * Get the tuner type. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static rtlsdr_tuner __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_type(CYTHON_UNUSED int __pyx_skip_dispatch) { rtlsdr_tuner __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tuner_type", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":136 + /* "urh/dev/native/lib/rtlsdr.pyx":155 * :return: RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise * """ * return crtlsdr.rtlsdr_get_tuner_type(_c_device) # <<<<<<<<<<<<<< @@ -2819,7 +3323,7 @@ static rtlsdr_tuner __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_type(CYTHON __pyx_r = rtlsdr_get_tuner_type(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":130 + /* "urh/dev/native/lib/rtlsdr.pyx":149 * return crtlsdr.rtlsdr_get_freq_correction(_c_device) * * cpdef crtlsdr.rtlsdr_tuner get_tuner_type(): # <<<<<<<<<<<<<< @@ -2834,26 +3338,26 @@ static rtlsdr_tuner __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_type(CYTHON } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type[] = "\n Get the tuner type.\n\n :return: RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_30get_tuner_type[] = "\n Get the tuner type.\n\n :return: RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tuner_type (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30get_tuner_type(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30get_tuner_type(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_tuner_type", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_rtlsdr_tuner(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_type(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_rtlsdr_tuner(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_type(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2870,7 +3374,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type(CYTHON return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":138 +/* "urh/dev/native/lib/rtlsdr.pyx":157 * return crtlsdr.rtlsdr_get_tuner_type(_c_device) * * cpdef list get_tuner_gains(): # <<<<<<<<<<<<<< @@ -2878,7 +3382,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type(CYTHON * Get a list of gains supported by the tuner. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_v_num_gains; int *__pyx_v_gains; @@ -2893,7 +3397,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("get_tuner_gains", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":146 + /* "urh/dev/native/lib/rtlsdr.pyx":165 * :return: gains array of gain values. In tenths of a dB, 115 means 11.5 dB. * """ * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) # <<<<<<<<<<<<<< @@ -2902,7 +3406,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U */ __pyx_v_num_gains = rtlsdr_get_tuner_gains(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, NULL); - /* "urh/dev/native/lib/rtlsdr.pyx":147 + /* "urh/dev/native/lib/rtlsdr.pyx":166 * """ * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) * if num_gains < 0: # <<<<<<<<<<<<<< @@ -2912,7 +3416,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U __pyx_t_1 = ((__pyx_v_num_gains < 0) != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/rtlsdr.pyx":148 + /* "urh/dev/native/lib/rtlsdr.pyx":167 * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) * if num_gains < 0: * return None # <<<<<<<<<<<<<< @@ -2923,7 +3427,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":147 + /* "urh/dev/native/lib/rtlsdr.pyx":166 * """ * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) * if num_gains < 0: # <<<<<<<<<<<<<< @@ -2932,7 +3436,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U */ } - /* "urh/dev/native/lib/rtlsdr.pyx":150 + /* "urh/dev/native/lib/rtlsdr.pyx":169 * return None * * cdef int*gains = malloc(num_gains * sizeof(int)) # <<<<<<<<<<<<<< @@ -2941,7 +3445,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U */ __pyx_v_gains = ((int *)malloc((__pyx_v_num_gains * (sizeof(int))))); - /* "urh/dev/native/lib/rtlsdr.pyx":151 + /* "urh/dev/native/lib/rtlsdr.pyx":170 * * cdef int*gains = malloc(num_gains * sizeof(int)) * crtlsdr.rtlsdr_get_tuner_gains(_c_device, gains) # <<<<<<<<<<<<<< @@ -2950,7 +3454,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U */ (void)(rtlsdr_get_tuner_gains(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_gains)); - /* "urh/dev/native/lib/rtlsdr.pyx":153 + /* "urh/dev/native/lib/rtlsdr.pyx":172 * crtlsdr.rtlsdr_get_tuner_gains(_c_device, gains) * * return [gains[i] for i in range(num_gains)] # <<<<<<<<<<<<<< @@ -2959,15 +3463,15 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U */ __Pyx_XDECREF(__pyx_r); { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_v_num_gains; __pyx_t_4 = __pyx_t_3; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_7genexpr__pyx_v_i = __pyx_t_5; - __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_gains[__pyx_7genexpr__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_gains[__pyx_7genexpr__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 153, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } /* exit inner scope */ @@ -2975,7 +3479,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U __pyx_t_2 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":138 + /* "urh/dev/native/lib/rtlsdr.pyx":157 * return crtlsdr.rtlsdr_get_tuner_type(_c_device) * * cpdef list get_tuner_gains(): # <<<<<<<<<<<<<< @@ -2996,26 +3500,26 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(CYTHON_U } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains[] = "\n Get a list of gains supported by the tuner.\n NOTE: The gains argument must be preallocated by the caller. If NULL is\n being given instead, the number of available gain values will be returned.\n\n :return: gains array of gain values. In tenths of a dB, 115 means 11.5 dB.\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gains[] = "\n Get a list of gains supported by the tuner.\n NOTE: The gains argument must be preallocated by the caller. If NULL is\n being given instead, the number of available gain values will be returned.\n\n :return: gains array of gain values. In tenths of a dB, 115 means 11.5 dB.\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tuner_gains (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gains(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gains(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_tuner_gains", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gains(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3032,7 +3536,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains(CYTHO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":155 +/* "urh/dev/native/lib/rtlsdr.pyx":174 * return [gains[i] for i in range(num_gains)] * * cpdef int set_tuner_gain(int gain): # <<<<<<<<<<<<<< @@ -3040,13 +3544,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains(CYTHO * Set the gain for the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain(int __pyx_v_gain, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_tuner_gain", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":169 + /* "urh/dev/native/lib/rtlsdr.pyx":188 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) # <<<<<<<<<<<<<< @@ -3056,7 +3560,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain(int __pyx_v_gai __pyx_r = rtlsdr_set_tuner_gain(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_gain); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":155 + /* "urh/dev/native/lib/rtlsdr.pyx":174 * return [gains[i] for i in range(num_gains)] * * cpdef int set_tuner_gain(int gain): # <<<<<<<<<<<<<< @@ -3071,15 +3575,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain(int __pyx_v_gai } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain[] = "\n Set the gain for the device.\n Manual gain mode must be enabled for this to work.\n\n Valid gain values (in tenths of a dB) for the E4000 tuner:\n -10, 15, 40, 65, 90, 115, 140, 165, 190,\n 215, 240, 290, 340, 420, 430, 450, 470, 490\n\n Valid gain values may be queried with rtlsdr_get_tuner_gains function.\n\n :param gain: gain in tenths of a dB, 115 means 11.5 dB.\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_gain[] = "\n Set the gain for the device.\n Manual gain mode must be enabled for this to work.\n\n Valid gain values (in tenths of a dB) for the E4000 tuner:\n -10, 15, 40, 65, 90, 115, 140, 165, 190,\n 215, 240, 290, 340, 420, 430, 450, 470, 490\n\n Valid gain values may be queried with rtlsdr_get_tuner_gains function.\n\n :param gain: gain in tenths of a dB, 115 means 11.5 dB.\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain) { int __pyx_v_gain; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_tuner_gain (wrapper)", 0); assert(__pyx_arg_gain); { - __pyx_v_gain = __Pyx_PyInt_As_int(__pyx_arg_gain); if (unlikely((__pyx_v_gain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) + __pyx_v_gain = __Pyx_PyInt_As_int(__pyx_arg_gain); if (unlikely((__pyx_v_gain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3087,20 +3591,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31set_tuner_gain(PyObje __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain(__pyx_self, ((int)__pyx_v_gain)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_gain(__pyx_self, ((int)__pyx_v_gain)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gain) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gain) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_tuner_gain", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain(__pyx_v_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain(__pyx_v_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3117,7 +3621,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain(CYTHON return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":171 +/* "urh/dev/native/lib/rtlsdr.pyx":190 * return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) * * cpdef int get_tuner_gain(): # <<<<<<<<<<<<<< @@ -3125,13 +3629,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain(CYTHON * Get actual gain the device is configured to. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gain(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tuner_gain", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":177 + /* "urh/dev/native/lib/rtlsdr.pyx":196 * :return: 0 on error, gain in tenths of a dB, 115 means 11.5 dB. * """ * return crtlsdr.rtlsdr_get_tuner_gain(_c_device) # <<<<<<<<<<<<<< @@ -3141,7 +3645,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gain(CYTHON_UNUSED i __pyx_r = rtlsdr_get_tuner_gain(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":171 + /* "urh/dev/native/lib/rtlsdr.pyx":190 * return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) * * cpdef int get_tuner_gain(): # <<<<<<<<<<<<<< @@ -3156,26 +3660,26 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gain(CYTHON_UNUSED i } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain[] = "\n Get actual gain the device is configured to.\n\n :return: 0 on error, gain in tenths of a dB, 115 means 11.5 dB.\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_36get_tuner_gain[] = "\n Get actual gain the device is configured to.\n\n :return: 0 on error, gain in tenths of a dB, 115 means 11.5 dB.\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tuner_gain (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36get_tuner_gain(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36get_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_tuner_gain", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gain(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_tuner_gain(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3192,7 +3696,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain(CYTHON return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":179 +/* "urh/dev/native/lib/rtlsdr.pyx":198 * return crtlsdr.rtlsdr_get_tuner_gain(_c_device) * * cpdef int set_tuner_if_gain(int stage, int gain): # <<<<<<<<<<<<<< @@ -3200,13 +3704,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain(CYTHON * Set the intermediate frequency gain for the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_if_gain(int __pyx_v_stage, int __pyx_v_gain, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_tuner_if_gain", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":187 + /* "urh/dev/native/lib/rtlsdr.pyx":206 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) # <<<<<<<<<<<<<< @@ -3216,7 +3720,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_if_gain(int __pyx_v_ __pyx_r = rtlsdr_set_tuner_if_gain(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_stage, __pyx_v_gain); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":179 + /* "urh/dev/native/lib/rtlsdr.pyx":198 * return crtlsdr.rtlsdr_get_tuner_gain(_c_device) * * cpdef int set_tuner_if_gain(int stage, int gain): # <<<<<<<<<<<<<< @@ -3231,9 +3735,9 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_if_gain(int __pyx_v_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain[] = "\n Set the intermediate frequency gain for the device.\n\n :param stage: intermediate frequency gain stage number (1 to 6 for E4000)\n :param gain: in tenths of a dB, -30 means -3.0 dB.\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_if_gain[] = "\n Set the intermediate frequency gain for the device.\n\n :param stage: intermediate frequency gain stage number (1 to 6 for E4000)\n :param gain: in tenths of a dB, -30 means -3.0 dB.\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_stage; int __pyx_v_gain; PyObject *__pyx_r = 0; @@ -3262,11 +3766,11 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_if_gain(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gain)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("set_tuner_if_gain", 1, 2, 2, 1); __PYX_ERR(0, 179, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_tuner_if_gain", 1, 2, 2, 1); __PYX_ERR(0, 198, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_tuner_if_gain") < 0)) __PYX_ERR(0, 179, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_tuner_if_gain") < 0)) __PYX_ERR(0, 198, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3274,31 +3778,31 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_if_gain(PyO values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_stage = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_stage == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L3_error) - __pyx_v_gain = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_gain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L3_error) + __pyx_v_stage = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_stage == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L3_error) + __pyx_v_gain = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_gain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_tuner_if_gain", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 179, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_tuner_if_gain", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 198, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.set_tuner_if_gain", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain(__pyx_self, __pyx_v_stage, __pyx_v_gain); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_if_gain(__pyx_self, __pyx_v_stage, __pyx_v_gain); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_stage, int __pyx_v_gain) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_if_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_stage, int __pyx_v_gain) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_tuner_if_gain", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_if_gain(__pyx_v_stage, __pyx_v_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_if_gain(__pyx_v_stage, __pyx_v_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3315,7 +3819,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain(CYT return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":189 +/* "urh/dev/native/lib/rtlsdr.pyx":208 * return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) * * cpdef int set_tuner_gain_mode(int manual): # <<<<<<<<<<<<<< @@ -3323,13 +3827,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain(CYT * Set the gain mode (automatic/manual) for the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain_mode(int __pyx_v_manual, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_tuner_gain_mode", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":197 + /* "urh/dev/native/lib/rtlsdr.pyx":216 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_tuner_gain_mode(_c_device, manual) # <<<<<<<<<<<<<< @@ -3339,7 +3843,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain_mode(int __pyx_ __pyx_r = rtlsdr_set_tuner_gain_mode(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_manual); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":189 + /* "urh/dev/native/lib/rtlsdr.pyx":208 * return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) * * cpdef int set_tuner_gain_mode(int manual): # <<<<<<<<<<<<<< @@ -3354,15 +3858,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain_mode(int __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode[] = "\n Set the gain mode (automatic/manual) for the device.\n Manual gain mode must be enabled for the gain setter function to work.\n\n :param manual: 1 means manual gain mode shall be enabled.\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_40set_tuner_gain_mode[] = "\n Set the gain mode (automatic/manual) for the device.\n Manual gain mode must be enabled for the gain setter function to work.\n\n :param manual: 1 means manual gain mode shall be enabled.\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual) { int __pyx_v_manual; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_tuner_gain_mode (wrapper)", 0); assert(__pyx_arg_manual); { - __pyx_v_manual = __Pyx_PyInt_As_int(__pyx_arg_manual); if (unlikely((__pyx_v_manual == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error) + __pyx_v_manual = __Pyx_PyInt_As_int(__pyx_arg_manual); if (unlikely((__pyx_v_manual == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3370,20 +3874,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37set_tuner_gain_mode(P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode(__pyx_self, ((int)__pyx_v_manual)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_tuner_gain_mode(__pyx_self, ((int)__pyx_v_manual)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_manual) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_tuner_gain_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_manual) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_tuner_gain_mode", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain_mode(__pyx_v_manual, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_gain_mode(__pyx_v_manual, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3400,7 +3904,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode(C return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":199 +/* "urh/dev/native/lib/rtlsdr.pyx":218 * return crtlsdr.rtlsdr_set_tuner_gain_mode(_c_device, manual) * * cpdef int set_tuner_bandwidth(uint32_t bw): # <<<<<<<<<<<<<< @@ -3408,22 +3912,53 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode(C * Set the bandwidth for the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_bandwidth(PyObject *__pyx_self, PyObject *__pyx_arg_bw); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43set_tuner_bandwidth(PyObject *__pyx_self, PyObject *__pyx_arg_bw); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_bandwidth(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_bw, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations + int __pyx_t_1; __Pyx_RefNannySetupContext("set_tuner_bandwidth", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":206 + /* "urh/dev/native/lib/rtlsdr.pyx":225 * :return 0 on success * """ - * crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) # <<<<<<<<<<<<<< + * if not crtlsdr.RTLSDR_HAS_BANDWIDTH: # <<<<<<<<<<<<<< + * return -100 + * + */ + __pyx_t_1 = ((!(RTLSDR_HAS_BANDWIDTH != 0)) != 0); + if (__pyx_t_1) { + + /* "urh/dev/native/lib/rtlsdr.pyx":226 + * """ + * if not crtlsdr.RTLSDR_HAS_BANDWIDTH: + * return -100 # <<<<<<<<<<<<<< + * + * return crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) + */ + __pyx_r = -100; + goto __pyx_L0; + + /* "urh/dev/native/lib/rtlsdr.pyx":225 + * :return 0 on success + * """ + * if not crtlsdr.RTLSDR_HAS_BANDWIDTH: # <<<<<<<<<<<<<< + * return -100 + * + */ + } + + /* "urh/dev/native/lib/rtlsdr.pyx":228 + * return -100 + * + * return crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) # <<<<<<<<<<<<<< * * cpdef int set_sample_rate(uint32_t sample_rate): */ - (void)(rtlsdr_set_tuner_bandwidth(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_bw)); + __pyx_r = rtlsdr_set_tuner_bandwidth(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_bw); + goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":199 + /* "urh/dev/native/lib/rtlsdr.pyx":218 * return crtlsdr.rtlsdr_set_tuner_gain_mode(_c_device, manual) * * cpdef int set_tuner_bandwidth(uint32_t bw): # <<<<<<<<<<<<<< @@ -3432,21 +3967,21 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_bandwidth(__pyx_t_3u */ /* function exit code */ - __pyx_r = 0; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_bandwidth(PyObject *__pyx_self, PyObject *__pyx_arg_bw); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_bandwidth[] = "\n Set the bandwidth for the device.\n\n :param bw: bandwidth in Hz. Zero means automatic BW selection.\n :return 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_bandwidth(PyObject *__pyx_self, PyObject *__pyx_arg_bw) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43set_tuner_bandwidth(PyObject *__pyx_self, PyObject *__pyx_arg_bw); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_42set_tuner_bandwidth[] = "\n Set the bandwidth for the device.\n\n :param bw: bandwidth in Hz. Zero means automatic BW selection.\n :return 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43set_tuner_bandwidth(PyObject *__pyx_self, PyObject *__pyx_arg_bw) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_bw; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_tuner_bandwidth (wrapper)", 0); assert(__pyx_arg_bw); { - __pyx_v_bw = __Pyx_PyInt_As_unsigned_int(__pyx_arg_bw); if (unlikely((__pyx_v_bw == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L3_error) + __pyx_v_bw = __Pyx_PyInt_As_unsigned_int(__pyx_arg_bw); if (unlikely((__pyx_v_bw == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3454,20 +3989,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_bandwidth(P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_bandwidth(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_bw)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42set_tuner_bandwidth(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_bw)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_bw) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42set_tuner_bandwidth(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_bw) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_tuner_bandwidth", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_bandwidth(__pyx_v_bw, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_tuner_bandwidth(__pyx_v_bw, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3484,21 +4019,21 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_bandwidth(C return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":208 - * crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) +/* "urh/dev/native/lib/rtlsdr.pyx":230 + * return crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) * * cpdef int set_sample_rate(uint32_t sample_rate): # <<<<<<<<<<<<<< * """ * Set the sample rate for the device, also selects the baseband filters */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_sample_rate(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_sample_rate, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_sample_rate", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":219 + /* "urh/dev/native/lib/rtlsdr.pyx":241 * :return: * """ * return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) # <<<<<<<<<<<<<< @@ -3508,8 +4043,8 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_sample_rate(__pyx_t_3urh_3 __pyx_r = rtlsdr_set_sample_rate(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_sample_rate); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":208 - * crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) + /* "urh/dev/native/lib/rtlsdr.pyx":230 + * return crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) * * cpdef int set_sample_rate(uint32_t sample_rate): # <<<<<<<<<<<<<< * """ @@ -3523,15 +4058,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_sample_rate(__pyx_t_3urh_3 } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate[] = "\n Set the sample rate for the device, also selects the baseband filters\n according to the requested sample rate for tuners where this is possible.\n\n :param sample_rate: the sample rate to be set, possible values are:\n 225001 - 300000 Hz\n \t\t 900001 - 3200000 Hz\n \t\t sample loss is to be expected for rates > 2400000\n :return:\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_44set_sample_rate[] = "\n Set the sample rate for the device, also selects the baseband filters\n according to the requested sample rate for tuners where this is possible.\n\n :param sample_rate: the sample rate to be set, possible values are:\n 225001 - 300000 Hz\n \t\t 900001 - 3200000 Hz\n \t\t sample loss is to be expected for rates > 2400000\n :return:\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_sample_rate; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_sample_rate (wrapper)", 0); assert(__pyx_arg_sample_rate); { - __pyx_v_sample_rate = __Pyx_PyInt_As_unsigned_int(__pyx_arg_sample_rate); if (unlikely((__pyx_v_sample_rate == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L3_error) + __pyx_v_sample_rate = __Pyx_PyInt_As_unsigned_int(__pyx_arg_sample_rate); if (unlikely((__pyx_v_sample_rate == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3539,20 +4074,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_sample_rate(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_sample_rate)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_sample_rate(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t)__pyx_v_sample_rate)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_sample_rate) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_v_sample_rate) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_sample_rate", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_sample_rate(__pyx_v_sample_rate, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_sample_rate(__pyx_v_sample_rate, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3569,7 +4104,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate(CYTHO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":221 +/* "urh/dev/native/lib/rtlsdr.pyx":243 * return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) * * cpdef uint32_t get_sample_rate(): # <<<<<<<<<<<<<< @@ -3577,13 +4112,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate(CYTHO * Get actual sample rate the device is configured to. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_sample_rate(CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_sample_rate", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":226 + /* "urh/dev/native/lib/rtlsdr.pyx":248 * :return: 0 on error, sample rate in Hz otherwise * """ * return crtlsdr.rtlsdr_get_sample_rate(_c_device) # <<<<<<<<<<<<<< @@ -3593,7 +4128,7 @@ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native __pyx_r = rtlsdr_get_sample_rate(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":221 + /* "urh/dev/native/lib/rtlsdr.pyx":243 * return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) * * cpdef uint32_t get_sample_rate(): # <<<<<<<<<<<<<< @@ -3608,26 +4143,26 @@ static __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint32_t __pyx_f_3urh_3dev_6native } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate[] = "\n Get actual sample rate the device is configured to.\n :return: 0 on error, sample rate in Hz otherwise\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_46get_sample_rate[] = "\n Get actual sample rate the device is configured to.\n :return: 0 on error, sample rate in Hz otherwise\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_sample_rate (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46get_sample_rate(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46get_sample_rate(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_sample_rate", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_sample_rate(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_sample_rate(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3644,7 +4179,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate(CYTHO return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":228 +/* "urh/dev/native/lib/rtlsdr.pyx":250 * return crtlsdr.rtlsdr_get_sample_rate(_c_device) * * cpdef int set_agc_mode(int on): # <<<<<<<<<<<<<< @@ -3652,13 +4187,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate(CYTHO * Enable or disable the internal digital Automatic Gain Control of the RTL2832. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_agc_mode(int __pyx_v_on, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_agc_mode", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":235 + /* "urh/dev/native/lib/rtlsdr.pyx":257 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) # <<<<<<<<<<<<<< @@ -3668,7 +4203,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_agc_mode(int __pyx_v_on, C __pyx_r = rtlsdr_set_agc_mode(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_on); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":228 + /* "urh/dev/native/lib/rtlsdr.pyx":250 * return crtlsdr.rtlsdr_get_sample_rate(_c_device) * * cpdef int set_agc_mode(int on): # <<<<<<<<<<<<<< @@ -3683,15 +4218,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_agc_mode(int __pyx_v_on, C } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode[] = "\n Enable or disable the internal digital Automatic Gain Control of the RTL2832.\n\n :param on: digital AGC mode, 1 means enabled, 0 disabled\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_48set_agc_mode[] = "\n Enable or disable the internal digital Automatic Gain Control of the RTL2832.\n\n :param on: digital AGC mode, 1 means enabled, 0 disabled\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on) { int __pyx_v_on; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_agc_mode (wrapper)", 0); assert(__pyx_arg_on); { - __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L3_error) + __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3699,20 +4234,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_agc_mode(PyObject __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode(__pyx_self, ((int)__pyx_v_on)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48set_agc_mode(__pyx_self, ((int)__pyx_v_on)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48set_agc_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_agc_mode", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_agc_mode(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_agc_mode(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3729,7 +4264,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode(CYTHON_U return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":237 +/* "urh/dev/native/lib/rtlsdr.pyx":259 * return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) * * cpdef int set_direct_sampling(int on): # <<<<<<<<<<<<<< @@ -3737,13 +4272,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode(CYTHON_U * Enable or disable the direct sampling mode. When enabled, the IF mode */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_direct_sampling(int __pyx_v_on, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_direct_sampling", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":247 + /* "urh/dev/native/lib/rtlsdr.pyx":269 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) # <<<<<<<<<<<<<< @@ -3753,7 +4288,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_direct_sampling(int __pyx_ __pyx_r = rtlsdr_set_direct_sampling(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_on); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":237 + /* "urh/dev/native/lib/rtlsdr.pyx":259 * return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) * * cpdef int set_direct_sampling(int on): # <<<<<<<<<<<<<< @@ -3768,15 +4303,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_direct_sampling(int __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling[] = "\n Enable or disable the direct sampling mode. When enabled, the IF mode\n of the RTL2832 is activated, and rtlsdr_set_center_freq() will control\n the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz\n (xtal frequency of the RTL2832).\n\n :param on: 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_50set_direct_sampling[] = "\n Enable or disable the direct sampling mode. When enabled, the IF mode\n of the RTL2832 is activated, and rtlsdr_set_center_freq() will control\n the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz\n (xtal frequency of the RTL2832).\n\n :param on: 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on) { int __pyx_v_on; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_direct_sampling (wrapper)", 0); assert(__pyx_arg_on); { - __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L3_error) + __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3784,20 +4319,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47set_direct_sampling(P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling(__pyx_self, ((int)__pyx_v_on)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_direct_sampling(__pyx_self, ((int)__pyx_v_on)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_direct_sampling", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_direct_sampling(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_direct_sampling(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3814,7 +4349,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling(C return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":249 +/* "urh/dev/native/lib/rtlsdr.pyx":271 * return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) * * cpdef int get_direct_sampling(): # <<<<<<<<<<<<<< @@ -3822,13 +4357,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling(C * Get state of the direct sampling mode */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_direct_sampling(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_direct_sampling", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":255 + /* "urh/dev/native/lib/rtlsdr.pyx":277 * :return: -1 on error, 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled * """ * return crtlsdr.rtlsdr_get_direct_sampling(_c_device) # <<<<<<<<<<<<<< @@ -3838,7 +4373,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_direct_sampling(CYTHON_UNU __pyx_r = rtlsdr_get_direct_sampling(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":249 + /* "urh/dev/native/lib/rtlsdr.pyx":271 * return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) * * cpdef int get_direct_sampling(): # <<<<<<<<<<<<<< @@ -3853,26 +4388,26 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_direct_sampling(CYTHON_UNU } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling[] = "\n Get state of the direct sampling mode\n\n :return: -1 on error, 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_52get_direct_sampling[] = "\n Get state of the direct sampling mode\n\n :return: -1 on error, 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_direct_sampling (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_direct_sampling(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_direct_sampling", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_direct_sampling(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_direct_sampling(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3889,7 +4424,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling(C return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":257 +/* "urh/dev/native/lib/rtlsdr.pyx":279 * return crtlsdr.rtlsdr_get_direct_sampling(_c_device) * * cpdef int set_offset_tuning(int on): # <<<<<<<<<<<<<< @@ -3897,13 +4432,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling(C * Enable or disable offset tuning for zero-IF tuners, which allows to avoid */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_offset_tuning(int __pyx_v_on, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_offset_tuning", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":265 + /* "urh/dev/native/lib/rtlsdr.pyx":287 * :return: 0 on success * """ * return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) # <<<<<<<<<<<<<< @@ -3913,7 +4448,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_offset_tuning(int __pyx_v_ __pyx_r = rtlsdr_set_offset_tuning(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_v_on); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":257 + /* "urh/dev/native/lib/rtlsdr.pyx":279 * return crtlsdr.rtlsdr_get_direct_sampling(_c_device) * * cpdef int set_offset_tuning(int on): # <<<<<<<<<<<<<< @@ -3928,15 +4463,15 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_offset_tuning(int __pyx_v_ } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning[] = "\n Enable or disable offset tuning for zero-IF tuners, which allows to avoid\n problems caused by the DC offset of the ADCs and 1/f noise.\n\n :param on: 0 means disabled, 1 enabled\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_54set_offset_tuning[] = "\n Enable or disable offset tuning for zero-IF tuners, which allows to avoid\n problems caused by the DC offset of the ADCs and 1/f noise.\n\n :param on: 0 means disabled, 1 enabled\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on) { int __pyx_v_on; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_offset_tuning (wrapper)", 0); assert(__pyx_arg_on); { - __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3944,20 +4479,20 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_offset_tuning(PyO __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning(__pyx_self, ((int)__pyx_v_on)); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54set_offset_tuning(__pyx_self, ((int)__pyx_v_on)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54set_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_offset_tuning", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_offset_tuning(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_set_offset_tuning(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3974,7 +4509,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning(CYT return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":267 +/* "urh/dev/native/lib/rtlsdr.pyx":289 * return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) * * cpdef int get_offset_tuning(): # <<<<<<<<<<<<<< @@ -3982,13 +4517,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning(CYT * Get state of the offset tuning mode */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_offset_tuning(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset_tuning", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":273 + /* "urh/dev/native/lib/rtlsdr.pyx":295 * :return: -1 on error, 0 means disabled, 1 enabled * """ * return crtlsdr.rtlsdr_get_offset_tuning(_c_device) # <<<<<<<<<<<<<< @@ -3998,7 +4533,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_offset_tuning(CYTHON_UNUSE __pyx_r = rtlsdr_get_offset_tuning(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":267 + /* "urh/dev/native/lib/rtlsdr.pyx":289 * return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) * * cpdef int get_offset_tuning(): # <<<<<<<<<<<<<< @@ -4013,26 +4548,26 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_offset_tuning(CYTHON_UNUSE } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning[] = "\n Get state of the offset tuning mode\n\n :return: -1 on error, 0 means disabled, 1 enabled\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_56get_offset_tuning[] = "\n Get state of the offset tuning mode\n\n :return: -1 on error, 0 means disabled, 1 enabled\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_offset_tuning (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56get_offset_tuning(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56get_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_offset_tuning", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_offset_tuning(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_get_offset_tuning(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4049,7 +4584,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning(CYT return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":275 +/* "urh/dev/native/lib/rtlsdr.pyx":297 * return crtlsdr.rtlsdr_get_offset_tuning(_c_device) * * cpdef int reset_buffer(): # <<<<<<<<<<<<<< @@ -4057,13 +4592,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning(CYT * */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_reset_buffer(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset_buffer", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":276 + /* "urh/dev/native/lib/rtlsdr.pyx":298 * * cpdef int reset_buffer(): * return crtlsdr.rtlsdr_reset_buffer(_c_device) # <<<<<<<<<<<<<< @@ -4073,7 +4608,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_reset_buffer(CYTHON_UNUSED int __pyx_r = rtlsdr_reset_buffer(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":275 + /* "urh/dev/native/lib/rtlsdr.pyx":297 * return crtlsdr.rtlsdr_get_offset_tuning(_c_device) * * cpdef int reset_buffer(): # <<<<<<<<<<<<<< @@ -4088,25 +4623,25 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_reset_buffer(CYTHON_UNUSED int } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset_buffer (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54reset_buffer(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58reset_buffer(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54reset_buffer(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58reset_buffer(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("reset_buffer", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_reset_buffer(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_reset_buffer(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4123,7 +4658,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54reset_buffer(CYTHON_U return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":278 +/* "urh/dev/native/lib/rtlsdr.pyx":300 * return crtlsdr.rtlsdr_reset_buffer(_c_device) * * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< @@ -4131,7 +4666,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_54reset_buffer(CYTHON_U * The raw, captured IQ data is 8 bit unsigned data. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_3urh_3dev_6native_3lib_6rtlsdr_read_sync *__pyx_optional_args) { int __pyx_v_num_samples = __pyx_k__4; __pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint8_t *__pyx_v_samples; @@ -4158,7 +4693,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED } } - /* "urh/dev/native/lib/rtlsdr.pyx":284 + /* "urh/dev/native/lib/rtlsdr.pyx":306 * :return: * """ * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) # <<<<<<<<<<<<<< @@ -4167,7 +4702,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED */ __pyx_v_samples = ((__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint8_t *)malloc(((2 * __pyx_v_num_samples) * (sizeof(__pyx_t_3urh_3dev_6native_3lib_6rtlsdr_uint8_t))))); - /* "urh/dev/native/lib/rtlsdr.pyx":285 + /* "urh/dev/native/lib/rtlsdr.pyx":307 * """ * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) * if not samples: # <<<<<<<<<<<<<< @@ -4177,16 +4712,16 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED __pyx_t_1 = ((!(__pyx_v_samples != 0)) != 0); if (unlikely(__pyx_t_1)) { - /* "urh/dev/native/lib/rtlsdr.pyx":286 + /* "urh/dev/native/lib/rtlsdr.pyx":308 * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) * if not samples: * raise MemoryError() # <<<<<<<<<<<<<< * * cdef int n_read = 0 */ - PyErr_NoMemory(); __PYX_ERR(0, 286, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 308, __pyx_L1_error) - /* "urh/dev/native/lib/rtlsdr.pyx":285 + /* "urh/dev/native/lib/rtlsdr.pyx":307 * """ * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) * if not samples: # <<<<<<<<<<<<<< @@ -4195,7 +4730,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED */ } - /* "urh/dev/native/lib/rtlsdr.pyx":288 + /* "urh/dev/native/lib/rtlsdr.pyx":310 * raise MemoryError() * * cdef int n_read = 0 # <<<<<<<<<<<<<< @@ -4204,7 +4739,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED */ __pyx_v_n_read = 0; - /* "urh/dev/native/lib/rtlsdr.pyx":289 + /* "urh/dev/native/lib/rtlsdr.pyx":311 * * cdef int n_read = 0 * try: # <<<<<<<<<<<<<< @@ -4213,7 +4748,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED */ /*try:*/ { - /* "urh/dev/native/lib/rtlsdr.pyx":290 + /* "urh/dev/native/lib/rtlsdr.pyx":312 * cdef int n_read = 0 * try: * crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) # <<<<<<<<<<<<<< @@ -4222,7 +4757,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED */ (void)(rtlsdr_read_sync(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, ((void *)__pyx_v_samples), __pyx_v_num_samples, (&__pyx_v_n_read))); - /* "urh/dev/native/lib/rtlsdr.pyx":291 + /* "urh/dev/native/lib/rtlsdr.pyx":313 * try: * crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) * return bytes(samples[0:n_read]) # <<<<<<<<<<<<<< @@ -4230,9 +4765,9 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED * free(samples) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_samples) + 0, __pyx_v_n_read - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L5_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_samples) + 0, __pyx_v_n_read - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L5_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject*)__pyx_t_3); @@ -4240,7 +4775,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED goto __pyx_L4_return; } - /* "urh/dev/native/lib/rtlsdr.pyx":293 + /* "urh/dev/native/lib/rtlsdr.pyx":315 * return bytes(samples[0:n_read]) * finally: * free(samples) # <<<<<<<<<<<<<< @@ -4291,7 +4826,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED } } - /* "urh/dev/native/lib/rtlsdr.pyx":278 + /* "urh/dev/native/lib/rtlsdr.pyx":300 * return crtlsdr.rtlsdr_reset_buffer(_c_device) * * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< @@ -4312,9 +4847,9 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(CYTHON_UNUSED } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_56read_sync[] = "\n The raw, captured IQ data is 8 bit unsigned data.\n\n :return:\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_60read_sync[] = "\n The raw, captured IQ data is 8 bit unsigned data.\n\n :return:\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_num_samples; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations @@ -4340,7 +4875,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57read_sync(PyObject *_ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_sync") < 0)) __PYX_ERR(0, 278, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_sync") < 0)) __PYX_ERR(0, 300, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4351,27 +4886,27 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57read_sync(PyObject *_ } } if (values[0]) { - __pyx_v_num_samples = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error) + __pyx_v_num_samples = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L3_error) } else { __pyx_v_num_samples = __pyx_k__4; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_sync", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 278, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_sync", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 300, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.read_sync", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56read_sync(__pyx_self, __pyx_v_num_samples); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60read_sync(__pyx_self, __pyx_v_num_samples); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56read_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_num_samples) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60read_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_num_samples) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4380,7 +4915,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56read_sync(CYTHON_UNUS __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.num_samples = __pyx_v_num_samples; - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_sync(0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4397,7 +4932,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56read_sync(CYTHON_UNUS return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":295 +/* "urh/dev/native/lib/rtlsdr.pyx":317 * free(samples) * * cpdef int read_async(callback, connection): # <<<<<<<<<<<<<< @@ -4405,22 +4940,22 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_56read_sync(CYTHON_UNUS * Read samples from the device asynchronously. This function will block until */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_63read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_async(PyObject *__pyx_v_callback, PyObject *__pyx_v_connection, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_async", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":303 + /* "urh/dev/native/lib/rtlsdr.pyx":325 * """ * global f * f = callback # <<<<<<<<<<<<<< * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f, __pyx_v_callback) < 0) __PYX_ERR(0, 303, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_f, __pyx_v_callback) < 0) __PYX_ERR(0, 325, __pyx_L1_error) - /* "urh/dev/native/lib/rtlsdr.pyx":304 + /* "urh/dev/native/lib/rtlsdr.pyx":326 * global f * f = callback * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) # <<<<<<<<<<<<<< @@ -4430,7 +4965,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_async(PyObject *__pyx_v_c __pyx_r = rtlsdr_read_async(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device, __pyx_f_3urh_3dev_6native_3lib_6rtlsdr__c_callback_recv, ((void *)__pyx_v_connection), 0, 0); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":295 + /* "urh/dev/native/lib/rtlsdr.pyx":317 * free(samples) * * cpdef int read_async(callback, connection): # <<<<<<<<<<<<<< @@ -4448,9 +4983,9 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_async(PyObject *__pyx_v_c } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_58read_async[] = "\n Read samples from the device asynchronously. This function will block until\n it is being canceled using rtlsdr_cancel_async()\n read_bytes_async\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_63read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_62read_async[] = "\n Read samples from the device asynchronously. This function will block until\n it is being canceled using rtlsdr_cancel_async()\n read_bytes_async\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_63read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_connection = 0; PyObject *__pyx_r = 0; @@ -4479,11 +5014,11 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59read_async(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("read_async", 1, 2, 2, 1); __PYX_ERR(0, 295, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_async", 1, 2, 2, 1); __PYX_ERR(0, 317, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_async") < 0)) __PYX_ERR(0, 295, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_async") < 0)) __PYX_ERR(0, 317, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4496,26 +5031,26 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59read_async(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_async", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 295, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_async", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 317, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr.read_async", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58read_async(__pyx_self, __pyx_v_callback, __pyx_v_connection); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_62read_async(__pyx_self, __pyx_v_callback, __pyx_v_connection); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58read_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_connection) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_62read_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_connection) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_async", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_async(__pyx_v_callback, __pyx_v_connection, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_read_async(__pyx_v_callback, __pyx_v_connection, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4532,7 +5067,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58read_async(CYTHON_UNU return __pyx_r; } -/* "urh/dev/native/lib/rtlsdr.pyx":306 +/* "urh/dev/native/lib/rtlsdr.pyx":328 * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) * * cpdef int cancel_async(): # <<<<<<<<<<<<<< @@ -4540,13 +5075,13 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_58read_async(CYTHON_UNU * Cancel all pending asynchronous operations on the device. */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_65cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_cancel_async(CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancel_async", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":312 + /* "urh/dev/native/lib/rtlsdr.pyx":334 * :return: 0 on success * """ * return crtlsdr.rtlsdr_cancel_async(_c_device) # <<<<<<<<<<<<<< @@ -4554,7 +5089,7 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_cancel_async(CYTHON_UNUSED int __pyx_r = rtlsdr_cancel_async(__pyx_v_3urh_3dev_6native_3lib_6rtlsdr__c_device); goto __pyx_L0; - /* "urh/dev/native/lib/rtlsdr.pyx":306 + /* "urh/dev/native/lib/rtlsdr.pyx":328 * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) * * cpdef int cancel_async(): # <<<<<<<<<<<<<< @@ -4569,26 +5104,26 @@ static int __pyx_f_3urh_3dev_6native_3lib_6rtlsdr_cancel_async(CYTHON_UNUSED int } /* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_60cancel_async[] = "\n Cancel all pending asynchronous operations on the device.\n\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_65cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_64cancel_async[] = "\n Cancel all pending asynchronous operations on the device.\n\n :return: 0 on success\n "; +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_65cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancel_async (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60cancel_async(__pyx_self); + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_64cancel_async(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60cancel_async(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_64cancel_async(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("cancel_async", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_cancel_async(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_6rtlsdr_cancel_async(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4606,37 +5141,39 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_6rtlsdr_60cancel_async(CYTHON_U } static PyMethodDef __pyx_methods[] = { - {"get_device_count", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1get_device_count, METH_NOARGS, 0}, - {"get_device_name", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_name, METH_O, 0}, - {"get_device_usb_strings", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_usb_strings, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_4get_device_usb_strings}, - {"get_index_by_serial", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_index_by_serial, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_6get_index_by_serial}, - {"open", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9open, METH_O, 0}, - {"close", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11close, METH_NOARGS, 0}, - {"set_xtal_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13set_xtal_freq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_12set_xtal_freq}, - {"get_xtal_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15get_xtal_freq, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_14get_xtal_freq}, - {"get_usb_strings", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17get_usb_strings, METH_NOARGS, 0}, - {"set_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19set_center_freq, METH_O, 0}, - {"get_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_center_freq, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_20get_center_freq}, - {"set_freq_correction", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_freq_correction, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_22set_freq_correction}, - {"get_freq_correction", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_freq_correction, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_24get_freq_correction}, - {"get_tuner_type", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27get_tuner_type, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_26get_tuner_type}, - {"get_tuner_gains", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_tuner_gains, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_28get_tuner_gains}, - {"set_tuner_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31set_tuner_gain, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_30set_tuner_gain}, - {"get_tuner_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gain, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gain}, - {"set_tuner_if_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_if_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_if_gain}, - {"set_tuner_gain_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37set_tuner_gain_mode, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_36set_tuner_gain_mode}, - {"set_tuner_bandwidth", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_bandwidth, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_bandwidth}, - {"set_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_sample_rate, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_40set_sample_rate}, - {"get_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43get_sample_rate, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_42get_sample_rate}, - {"set_agc_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_agc_mode, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_44set_agc_mode}, - {"set_direct_sampling", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47set_direct_sampling, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_46set_direct_sampling}, - {"get_direct_sampling", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49get_direct_sampling, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_48get_direct_sampling}, - {"set_offset_tuning", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_offset_tuning, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_50set_offset_tuning}, - {"get_offset_tuning", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_offset_tuning, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_52get_offset_tuning}, - {"reset_buffer", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55reset_buffer, METH_NOARGS, 0}, - {"read_sync", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57read_sync, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_56read_sync}, - {"read_async", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59read_async, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_58read_async}, - {"cancel_async", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61cancel_async, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_60cancel_async}, + {"bandwidth_is_adjustable", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_1bandwidth_is_adjustable, METH_NOARGS, 0}, + {"get_device_count", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_3get_device_count, METH_NOARGS, 0}, + {"get_device_name", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_5get_device_name, METH_O, 0}, + {"get_device_usb_strings", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_7get_device_usb_strings, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_6get_device_usb_strings}, + {"get_index_by_serial", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_9get_index_by_serial, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_8get_index_by_serial}, + {"get_device_list", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_11get_device_list, METH_NOARGS, 0}, + {"open", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_13open, METH_O, 0}, + {"close", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_15close, METH_NOARGS, 0}, + {"set_xtal_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_17set_xtal_freq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_16set_xtal_freq}, + {"get_xtal_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_19get_xtal_freq, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_18get_xtal_freq}, + {"get_usb_strings", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_21get_usb_strings, METH_NOARGS, 0}, + {"set_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_23set_center_freq, METH_O, 0}, + {"get_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_25get_center_freq, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_24get_center_freq}, + {"set_freq_correction", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_27set_freq_correction, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_26set_freq_correction}, + {"get_freq_correction", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_29get_freq_correction, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_28get_freq_correction}, + {"get_tuner_type", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_31get_tuner_type, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_30get_tuner_type}, + {"get_tuner_gains", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_33get_tuner_gains, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_32get_tuner_gains}, + {"set_tuner_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_35set_tuner_gain, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_34set_tuner_gain}, + {"get_tuner_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_37get_tuner_gain, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_36get_tuner_gain}, + {"set_tuner_if_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_39set_tuner_if_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_38set_tuner_if_gain}, + {"set_tuner_gain_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_41set_tuner_gain_mode, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_40set_tuner_gain_mode}, + {"set_tuner_bandwidth", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_43set_tuner_bandwidth, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_42set_tuner_bandwidth}, + {"set_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_45set_sample_rate, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_44set_sample_rate}, + {"get_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_47get_sample_rate, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_46get_sample_rate}, + {"set_agc_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_49set_agc_mode, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_48set_agc_mode}, + {"set_direct_sampling", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_51set_direct_sampling, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_50set_direct_sampling}, + {"get_direct_sampling", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_53get_direct_sampling, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_52get_direct_sampling}, + {"set_offset_tuning", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_55set_offset_tuning, METH_O, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_54set_offset_tuning}, + {"get_offset_tuning", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_57get_offset_tuning, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_56get_offset_tuning}, + {"reset_buffer", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_59reset_buffer, METH_NOARGS, 0}, + {"read_sync", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_61read_sync, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_60read_sync}, + {"read_async", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_63read_async, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_62read_async}, + {"cancel_async", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_6rtlsdr_65cancel_async, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_6rtlsdr_64cancel_async}, {0, 0, 0, 0} }; @@ -4674,10 +5211,12 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_u_SN, __pyx_k_SN, sizeof(__pyx_k_SN), 0, 1, 0, 0}, {&__pyx_n_s_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_connection, __pyx_k_connection, sizeof(__pyx_k_connection), 0, 0, 1, 1}, {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_n_s_gain, __pyx_k_gain, sizeof(__pyx_k_gain), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_num_samples, __pyx_k_num_samples, sizeof(__pyx_k_num_samples), 0, 0, 1, 1}, @@ -4689,8 +5228,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 153, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 286, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 308, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -4700,36 +5239,36 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "urh/dev/native/lib/rtlsdr.pyx":38 - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - * return None, None, None # <<<<<<<<<<<<<< - * - * cpdef int get_index_by_serial(str serial): + /* "urh/dev/native/lib/rtlsdr.pyx":45 + * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') + * else: + * return None, None, None # <<<<<<<<<<<<<< + * finally: + * free(manufacturer) */ - __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "urh/dev/native/lib/rtlsdr.pyx":90 + /* "urh/dev/native/lib/rtlsdr.pyx":109 * return rtl_freq, tuner_freq * else: * return None, None # <<<<<<<<<<<<<< * * cpdef tuple get_usb_strings(): */ - __pyx_tuple__2 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "urh/dev/native/lib/rtlsdr.pyx":100 + /* "urh/dev/native/lib/rtlsdr.pyx":119 * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') * else: * return None, None, None # <<<<<<<<<<<<<< * * cpdef int set_center_freq(uint32_t freq): */ - __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); __Pyx_RefNannyFinishContext(); @@ -4880,7 +5419,7 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d } -static int __pyx_pymod_exec_rtlsdr(PyObject *__pyx_pyinit_module) CYTHON_SMALL_CODE +static int __pyx_pymod_exec_rtlsdr(PyObject *__pyx_pyinit_module) #endif #endif { @@ -4983,7 +5522,7 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "urh/dev/native/lib/rtlsdr.pyx":278 + /* "urh/dev/native/lib/rtlsdr.pyx":300 * return crtlsdr.rtlsdr_reset_buffer(_c_device) * * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< @@ -5422,8 +5961,151 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject } } +/* GetException */ + #if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +#endif + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if PY_VERSION_HEX >= 0x030700A2 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = local_type; + tstate->exc_state.exc_value = local_value; + tstate->exc_state.exc_traceback = local_tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* SwapException */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030700A2 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = *type; + tstate->exc_state.exc_value = *value; + tstate->exc_state.exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* SaveResetException */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if PY_VERSION_HEX >= 0x030700A2 + *type = tstate->exc_state.exc_type; + *value = tstate->exc_state.exc_value; + *tb = tstate->exc_state.exc_traceback; + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + #endif + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030700A2 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = type; + tstate->exc_state.exc_value = value; + tstate->exc_state.exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +#endif + /* ArgTypeTest */ - static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) + static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); @@ -5443,8 +6125,26 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject return 0; } +/* RaiseTooManyValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + /* RaiseArgTupleInvalid */ - static void __Pyx_RaiseArgtupleInvalid( + static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, @@ -5470,7 +6170,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject } /* RaiseDoubleKeywords */ - static void __Pyx_RaiseDoubleKeywordsError( + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { @@ -5484,7 +6184,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject } /* ParseKeywords */ - static int __Pyx_ParseOptionalKeywords( + static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, @@ -5585,149 +6285,6 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject return -1; } -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { -#endif - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = local_type; - tstate->exc_state.exc_value = local_value; - tstate->exc_state.exc_traceback = local_tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = *type; - tstate->exc_state.exc_value = *value; - tstate->exc_state.exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A2 - *type = tstate->exc_state.exc_type; - *value = tstate->exc_state.exc_value; - *tb = tstate->exc_state.exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = type; - tstate->exc_state.exc_value = value; - tstate->exc_state.exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { diff --git a/src/urh/dev/native/lib/rtlsdr.pyx b/src/urh/dev/native/lib/rtlsdr.pyx index ef5b5574f0..ba2486f268 100644 --- a/src/urh/dev/native/lib/rtlsdr.pyx +++ b/src/urh/dev/native/lib/rtlsdr.pyx @@ -16,6 +16,12 @@ cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx): (f)(buffer[0:length]) +cpdef bandwidth_is_adjustable(): + if crtlsdr.RTLSDR_HAS_BANDWIDTH: + return True + else: + return False + cpdef uint32_t get_device_count(): return crtlsdr.rtlsdr_get_device_count() @@ -32,10 +38,15 @@ cpdef tuple get_device_usb_strings(uint32_t index): cdef char *product = malloc(256 * sizeof(char)) cdef char *serial = malloc(256 * sizeof(char)) result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - if result == 0: - return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - else: - return None, None, None + try: + if result == 0: + return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') + else: + return None, None, None + finally: + free(manufacturer) + free(product) + free(serial) cpdef int get_index_by_serial(str serial): """ @@ -50,6 +61,14 @@ cpdef int get_index_by_serial(str serial): serial_byte_string = serial.encode('UTF-8') return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) +cpdef list get_device_list(): + result = [] + cdef uint32_t i, n = get_device_count() + for i in range(n): + manufacturer, product, serial = get_device_usb_strings(i) + result.append("{} {} (SN: {})".format(manufacturer, product, serial)) + return result + cpdef int open(uint32_t index): return crtlsdr.rtlsdr_open(&_c_device, index) @@ -203,7 +222,10 @@ cpdef int set_tuner_bandwidth(uint32_t bw): :param bw: bandwidth in Hz. Zero means automatic BW selection. :return 0 on success """ - crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) + if not crtlsdr.RTLSDR_HAS_BANDWIDTH: + return -100 + + return crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) cpdef int set_sample_rate(uint32_t sample_rate): """ diff --git a/src/urh/dev/native/lib/rtlsdr_fallback.cpp b/src/urh/dev/native/lib/rtlsdr_fallback.cpp deleted file mode 100644 index 93ba66ed1c..0000000000 --- a/src/urh/dev/native/lib/rtlsdr_fallback.cpp +++ /dev/null @@ -1,6893 +0,0 @@ -/* Generated by Cython 0.28 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [ - "/home/joe/GIT/urh/src/urh/dev/native/includes/rtl-sdr.h" - ], - "extra_compile_args": [ - "-Wno-cpp" - ], - "include_dirs": [ - "/home/joe/GIT/urh/src/urh/dev/native/includes" - ], - "language": "c++", - "libraries": [ - "rtlsdr" - ], - "name": "urh.dev.native.lib.rtlsdr_fallback", - "sources": [ - "src/urh/dev/native/lib/rtlsdr_fallback.pyx" - ] - }, - "module_name": "urh.dev.native.lib.rtlsdr_fallback" -} -END: Cython Metadata */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. -#else -#define CYTHON_ABI "0_28" -#define CYTHON_FUTURE_DIVISION 1 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -#ifndef __cplusplus - #error "Cython files generated with the C++ option must be compiled with a C++ compiler." -#endif -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #else - #define CYTHON_INLINE inline - #endif -#endif -template -void __Pyx_call_destructor(T& x) { - x.~T(); -} -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } - T *operator->() { return ptr; } - T *operator&() { return ptr; } - operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } - private: - T *ptr; -}; - -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; // PyThread_create_key reports success always -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif // TSS (Thread Specific Storage) API -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -#else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__urh__dev__native__lib__rtlsdr_fallback -#define __PYX_HAVE_API__urh__dev__native__lib__rtlsdr_fallback -/* Early includes */ -#include "rtl-sdr.h" -#include -#include -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/urh/dev/native/lib/rtlsdr_fallback.pyx", -}; - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":7 - * from libc.stdlib cimport malloc, free - * - * ctypedef unsigned char uint8_t # <<<<<<<<<<<<<< - * ctypedef unsigned short uint16_t - * ctypedef unsigned int uint32_t - */ -typedef unsigned char __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint8_t; - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":8 - * - * ctypedef unsigned char uint8_t - * ctypedef unsigned short uint16_t # <<<<<<<<<<<<<< - * ctypedef unsigned int uint32_t - * ctypedef unsigned long long uint64_t - */ -typedef unsigned short __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint16_t; - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":9 - * ctypedef unsigned char uint8_t - * ctypedef unsigned short uint16_t - * ctypedef unsigned int uint32_t # <<<<<<<<<<<<<< - * ctypedef unsigned long long uint64_t - * - */ -typedef unsigned int __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t; - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":10 - * ctypedef unsigned short uint16_t - * ctypedef unsigned int uint32_t - * ctypedef unsigned long long uint64_t # <<<<<<<<<<<<<< - * - * cdef crtlsdr.rtlsdr_dev_t*_c_device - */ -typedef unsigned PY_LONG_LONG __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint64_t; - -/*--- Type declarations ---*/ -struct __pyx_opt_args_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync; - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":279 - * return crtlsdr.rtlsdr_reset_buffer(_c_device) - * - * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< - * """ - * The raw, captured IQ data is 8 bit unsigned data. - */ -struct __pyx_opt_args_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync { - int __pyx_n; - int num_samples; -}; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* IncludeStringH.proto */ -#include - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_rtlsdr_tuner(rtlsdr_tuner value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'crtlsdr' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'urh.dev.native.lib.rtlsdr_fallback' */ -static rtlsdr_dev_t *__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device; -static void __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_callback_recv(unsigned char *, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, void *); /*proto*/ -static __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_count(int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_name(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_usb_strings(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_index_by_serial(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_open(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_close(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_xtal_freq(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_xtal_freq(int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_usb_strings(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_center_freq(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, int __pyx_skip_dispatch); /*proto*/ -static __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_center_freq(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_freq_correction(int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_freq_correction(int __pyx_skip_dispatch); /*proto*/ -static rtlsdr_tuner __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_type(int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_gains(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_gain(int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_gain(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_if_gain(int, int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_gain_mode(int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_sample_rate(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t, int __pyx_skip_dispatch); /*proto*/ -static __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_sample_rate(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_agc_mode(int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_direct_sampling(int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_direct_sampling(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_offset_tuning(int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_offset_tuning(int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_reset_buffer(int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync(int __pyx_skip_dispatch, struct __pyx_opt_args_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync *__pyx_optional_args); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_async(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_cancel_async(int __pyx_skip_dispatch); /*proto*/ -#define __Pyx_MODULE_NAME "urh.dev.native.lib.rtlsdr_fallback" -extern int __pyx_module_is_main_urh__dev__native__lib__rtlsdr_fallback; -int __pyx_module_is_main_urh__dev__native__lib__rtlsdr_fallback = 0; - -/* Implementation of 'urh.dev.native.lib.rtlsdr_fallback' */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_MemoryError; -static const char __pyx_k_f[] = "f"; -static const char __pyx_k_gain[] = "gain"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_stage[] = "stage"; -static const char __pyx_k_callback[] = "callback"; -static const char __pyx_k_rtl_freq[] = "rtl_freq"; -static const char __pyx_k_connection[] = "connection"; -static const char __pyx_k_tuner_freq[] = "tuner_freq"; -static const char __pyx_k_MemoryError[] = "MemoryError"; -static const char __pyx_k_num_samples[] = "num_samples"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_n_s_callback; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_connection; -static PyObject *__pyx_n_s_f; -static PyObject *__pyx_n_s_gain; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_num_samples; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_rtl_freq; -static PyObject *__pyx_n_s_stage; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tuner_freq; -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_count(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_2get_device_name(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_4get_device_usb_strings(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_6get_index_by_serial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_8open(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_10close(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_12set_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_tuner_freq); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_14get_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_16get_usb_strings(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_18set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_freq); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_20get_center_freq(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_22set_freq_correction(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ppm); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_24get_freq_correction(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_26get_tuner_type(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_28get_tuner_gains(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_30set_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gain); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_32get_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_34set_tuner_if_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_stage, int __pyx_v_gain); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_36set_tuner_gain_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_manual); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_38set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_sample_rate); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_40get_sample_rate(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_42set_agc_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_44set_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_46get_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_48set_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_50get_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_52reset_buffer(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_54read_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_num_samples); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_56read_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_connection); /* proto */ -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_58cancel_async(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static int __pyx_k__4; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -/* Late includes */ - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":14 - * cdef crtlsdr.rtlsdr_dev_t*_c_device - * - * cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx): # <<<<<<<<<<<<<< - * global f - * conn = ctx - */ - -static void __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_callback_recv(unsigned char *__pyx_v_buffer, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_length, void *__pyx_v_ctx) { - CYTHON_UNUSED PyObject *__pyx_v_conn = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("_c_callback_recv", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":16 - * cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx): - * global f - * conn = ctx # <<<<<<<<<<<<<< - * (f)(buffer[0:length]) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_ctx); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_conn = __pyx_t_1; - __pyx_t_1 = 0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":17 - * global f - * conn = ctx - * (f)(buffer[0:length]) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_buffer) + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_t_2)); - __pyx_t_4 = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":14 - * cdef crtlsdr.rtlsdr_dev_t*_c_device - * - * cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx): # <<<<<<<<<<<<<< - * global f - * conn = ctx - */ - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("urh.dev.native.lib.rtlsdr_fallback._c_callback_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_conn); - __Pyx_RefNannyFinishContext(); -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":20 - * - * - * cpdef uint32_t get_device_count(): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_get_device_count() - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_1get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_count(CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_device_count", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":21 - * - * cpdef uint32_t get_device_count(): - * return crtlsdr.rtlsdr_get_device_count() # <<<<<<<<<<<<<< - * - * cpdef str get_device_name(uint32_t index): - */ - __pyx_r = rtlsdr_get_device_count(); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":20 - * - * - * cpdef uint32_t get_device_count(): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_get_device_count() - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_1get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_1get_device_count(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_device_count (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_count(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_count(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_device_count", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_count(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_count", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":23 - * return crtlsdr.rtlsdr_get_device_count() - * - * cpdef str get_device_name(uint32_t index): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_3get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_name(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char const *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("get_device_name", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":24 - * - * cpdef str get_device_name(uint32_t index): - * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') # <<<<<<<<<<<<<< - * - * cpdef tuple get_device_usb_strings(uint32_t index): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = rtlsdr_get_device_name(__pyx_v_index); - __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_INCREF(__pyx_t_2); - __pyx_r = ((PyObject*)__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":23 - * return crtlsdr.rtlsdr_get_device_count() - * - * cpdef str get_device_name(uint32_t index): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_3get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_3get_device_name(PyObject *__pyx_self, PyObject *__pyx_arg_index) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_device_name (wrapper)", 0); - assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_2get_device_name(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_2get_device_name(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_device_name", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_name(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":26 - * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') - * - * cpdef tuple get_device_usb_strings(uint32_t index): # <<<<<<<<<<<<<< - * """ - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_5get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_usb_strings(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { - char *__pyx_v_manufacturer; - char *__pyx_v_product; - char *__pyx_v_serial; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("get_device_usb_strings", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":32 - * :return: manufacturer name, product name, serial serial number on success else None, None, None - * """ - * cdef char *manufacturer = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< - * cdef char *product = malloc(256 * sizeof(char)) - * cdef char *serial = malloc(256 * sizeof(char)) - */ - __pyx_v_manufacturer = ((char *)malloc((0x100 * (sizeof(char))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":33 - * """ - * cdef char *manufacturer = malloc(256 * sizeof(char)) - * cdef char *product = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - */ - __pyx_v_product = ((char *)malloc((0x100 * (sizeof(char))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":34 - * cdef char *manufacturer = malloc(256 * sizeof(char)) - * cdef char *product = malloc(256 * sizeof(char)) - * cdef char *serial = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< - * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: - */ - __pyx_v_serial = ((char *)malloc((0x100 * (sizeof(char))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":35 - * cdef char *product = malloc(256 * sizeof(char)) - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) # <<<<<<<<<<<<<< - * if result == 0: - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - */ - __pyx_v_result = rtlsdr_get_device_usb_strings(__pyx_v_index, __pyx_v_manufacturer, __pyx_v_product, __pyx_v_serial); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":36 - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: # <<<<<<<<<<<<<< - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - */ - __pyx_t_1 = ((__pyx_v_result == 0) != 0); - if (__pyx_t_1) { - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":37 - * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') # <<<<<<<<<<<<<< - * else: - * return None, None, None - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_manufacturer, 0, strlen(__pyx_v_manufacturer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_product, 0, strlen(__pyx_v_product), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_serial, 0, strlen(__pyx_v_serial), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":36 - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - * if result == 0: # <<<<<<<<<<<<<< - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - */ - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":39 - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - * return None, None, None # <<<<<<<<<<<<<< - * - * cpdef int get_index_by_serial(str serial): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_tuple_); - __pyx_r = __pyx_tuple_; - goto __pyx_L0; - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":26 - * return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') - * - * cpdef tuple get_device_usb_strings(uint32_t index): # <<<<<<<<<<<<<< - * """ - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_usb_strings", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_5get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_4get_device_usb_strings[] = "\n\n :param index: index of the device\n :return: manufacturer name, product name, serial serial number on success else None, None, None\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_5get_device_usb_strings(PyObject *__pyx_self, PyObject *__pyx_arg_index) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_device_usb_strings (wrapper)", 0); - assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_usb_strings", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_4get_device_usb_strings(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_4get_device_usb_strings(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_device_usb_strings", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_device_usb_strings(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_device_usb_strings", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":41 - * return None, None, None - * - * cpdef int get_index_by_serial(str serial): # <<<<<<<<<<<<<< - * """ - * Get device index by USB serial string descriptor. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_7get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_index_by_serial(PyObject *__pyx_v_serial, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_v_serial_byte_string = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; - __Pyx_RefNannySetupContext("get_index_by_serial", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":51 - * -3 if devices were found, but none with matching name - * """ - * serial_byte_string = serial.encode('UTF-8') # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) - * - */ - if (unlikely(__pyx_v_serial == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 51, __pyx_L1_error) - } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_serial); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_serial_byte_string = __pyx_t_1; - __pyx_t_1 = 0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":52 - * """ - * serial_byte_string = serial.encode('UTF-8') - * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) # <<<<<<<<<<<<<< - * - * cpdef int open(uint32_t index): - */ - __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_serial_byte_string); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error) - __pyx_r = rtlsdr_get_index_by_serial(((char *)__pyx_t_2)); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":41 - * return None, None, None - * - * cpdef int get_index_by_serial(str serial): # <<<<<<<<<<<<<< - * """ - * Get device index by USB serial string descriptor. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_WriteUnraisable("urh.dev.native.lib.rtlsdr_fallback.get_index_by_serial", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_serial_byte_string); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_7get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_6get_index_by_serial[] = "\n Get device index by USB serial string descriptor.\n\n :param serial: serial string of the device\n :return: device index of first device where the name matched\n -1 if name is NULL\n -2 if no devices were found at all\n -3 if devices were found, but none with matching name\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_7get_index_by_serial(PyObject *__pyx_self, PyObject *__pyx_v_serial) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_index_by_serial (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_serial), (&PyUnicode_Type), 1, "serial", 1))) __PYX_ERR(0, 41, __pyx_L1_error) - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_6get_index_by_serial(__pyx_self, ((PyObject*)__pyx_v_serial)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_6get_index_by_serial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_serial) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_index_by_serial", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_index_by_serial(__pyx_v_serial, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_index_by_serial", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":54 - * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) - * - * cpdef int open(uint32_t index): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_open(&_c_device, index) - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_9open(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_open(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":55 - * - * cpdef int open(uint32_t index): - * return crtlsdr.rtlsdr_open(&_c_device, index) # <<<<<<<<<<<<<< - * - * cpdef int close(): - */ - __pyx_r = rtlsdr_open((&__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device), __pyx_v_index); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":54 - * return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) - * - * cpdef int open(uint32_t index): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_open(&_c_device, index) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_9open(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_9open(PyObject *__pyx_self, PyObject *__pyx_arg_index) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open (wrapper)", 0); - assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyInt_As_unsigned_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.open", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_8open(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_8open(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_index) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("open", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_open(__pyx_v_index, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.open", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":57 - * return crtlsdr.rtlsdr_open(&_c_device, index) - * - * cpdef int close(): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_close(_c_device) - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_11close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_close(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":58 - * - * cpdef int close(): - * return crtlsdr.rtlsdr_close(_c_device) # <<<<<<<<<<<<<< - * - * cpdef int set_xtal_freq(uint32_t rtl_freq, uint32_t tuner_freq): - */ - __pyx_r = rtlsdr_close(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":57 - * return crtlsdr.rtlsdr_open(&_c_device, index) - * - * cpdef int close(): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_close(_c_device) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_11close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_11close(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_10close(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_10close(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("close", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_close(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":60 - * return crtlsdr.rtlsdr_close(_c_device) - * - * cpdef int set_xtal_freq(uint32_t rtl_freq, uint32_t tuner_freq): # <<<<<<<<<<<<<< - * """ - * Set crystal oscillator frequencies used for the RTL2832 and the tuner IC. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_13set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_xtal_freq(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_tuner_freq, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_xtal_freq", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":74 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) # <<<<<<<<<<<<<< - * - * cpdef tuple get_xtal_freq(): - */ - __pyx_r = rtlsdr_set_xtal_freq(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_rtl_freq, __pyx_v_tuner_freq); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":60 - * return crtlsdr.rtlsdr_close(_c_device) - * - * cpdef int set_xtal_freq(uint32_t rtl_freq, uint32_t tuner_freq): # <<<<<<<<<<<<<< - * """ - * Set crystal oscillator frequencies used for the RTL2832 and the tuner IC. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_13set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_12set_xtal_freq[] = "\n Set crystal oscillator frequencies used for the RTL2832 and the tuner IC.\n\n Usually both ICs use the same clock. Changing the clock may make sense if\n you are applying an external clock to the tuner or to compensate the\n frequency (and samplerate) error caused by the original (cheap) crystal.\n\n NOTE: Call this function only if you fully understand the implications.\n\n :param rtl_freq: frequency value used to clock the RTL2832 in Hz\n :param tuner_freq: frequency value used to clock the tuner IC in Hz\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_13set_xtal_freq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_rtl_freq; - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_tuner_freq; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_xtal_freq (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rtl_freq,&__pyx_n_s_tuner_freq,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rtl_freq)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tuner_freq)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_xtal_freq", 1, 2, 2, 1); __PYX_ERR(0, 60, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_xtal_freq") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_rtl_freq = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_rtl_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) - __pyx_v_tuner_freq = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_tuner_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_xtal_freq", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_xtal_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_12set_xtal_freq(__pyx_self, __pyx_v_rtl_freq, __pyx_v_tuner_freq); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_12set_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_rtl_freq, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_tuner_freq) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_xtal_freq", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_xtal_freq(__pyx_v_rtl_freq, __pyx_v_tuner_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_xtal_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":76 - * return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) - * - * cpdef tuple get_xtal_freq(): # <<<<<<<<<<<<<< - * """ - * Get crystal oscillator frequencies used for the RTL2832 and the tuner IC. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_15get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_xtal_freq(CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_rtl_freq; - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_tuner_freq; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("get_xtal_freq", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":84 - * tuner_freq frequency value used to clock the tuner IC in Hz - * """ - * cdef uint32_t rtl_freq = 0 # <<<<<<<<<<<<<< - * cdef uint32_t tuner_freq = 0 - * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) - */ - __pyx_v_rtl_freq = 0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":85 - * """ - * cdef uint32_t rtl_freq = 0 - * cdef uint32_t tuner_freq = 0 # <<<<<<<<<<<<<< - * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) - * - */ - __pyx_v_tuner_freq = 0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":86 - * cdef uint32_t rtl_freq = 0 - * cdef uint32_t tuner_freq = 0 - * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) # <<<<<<<<<<<<<< - * - * if result == 0: - */ - __pyx_v_result = rtlsdr_get_xtal_freq(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, (&__pyx_v_rtl_freq), (&__pyx_v_tuner_freq)); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":88 - * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) - * - * if result == 0: # <<<<<<<<<<<<<< - * return rtl_freq, tuner_freq - * else: - */ - __pyx_t_1 = ((__pyx_v_result == 0) != 0); - if (__pyx_t_1) { - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":89 - * - * if result == 0: - * return rtl_freq, tuner_freq # <<<<<<<<<<<<<< - * else: - * return None, None - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_rtl_freq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_tuner_freq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_r = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":88 - * result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) - * - * if result == 0: # <<<<<<<<<<<<<< - * return rtl_freq, tuner_freq - * else: - */ - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":91 - * return rtl_freq, tuner_freq - * else: - * return None, None # <<<<<<<<<<<<<< - * - * cpdef tuple get_usb_strings(): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_tuple__2); - __pyx_r = __pyx_tuple__2; - goto __pyx_L0; - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":76 - * return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) - * - * cpdef tuple get_xtal_freq(): # <<<<<<<<<<<<<< - * """ - * Get crystal oscillator frequencies used for the RTL2832 and the tuner IC. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_xtal_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_15get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_14get_xtal_freq[] = "\n Get crystal oscillator frequencies used for the RTL2832 and the tuner IC.\n Usually both ICs use the same clock.\n\n :return: rtl_freq frequency value used to clock the RTL2832 in Hz,\n tuner_freq frequency value used to clock the tuner IC in Hz\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_15get_xtal_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_xtal_freq (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_14get_xtal_freq(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_14get_xtal_freq(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_xtal_freq", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_xtal_freq(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_xtal_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":93 - * return None, None - * - * cpdef tuple get_usb_strings(): # <<<<<<<<<<<<<< - * cdef char *manufacturer = malloc(256 * sizeof(char)) - * cdef char *product = malloc(256 * sizeof(char)) - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_17get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_usb_strings(CYTHON_UNUSED int __pyx_skip_dispatch) { - char *__pyx_v_manufacturer; - char *__pyx_v_product; - char *__pyx_v_serial; - int __pyx_v_result; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("get_usb_strings", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":94 - * - * cpdef tuple get_usb_strings(): - * cdef char *manufacturer = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< - * cdef char *product = malloc(256 * sizeof(char)) - * cdef char *serial = malloc(256 * sizeof(char)) - */ - __pyx_v_manufacturer = ((char *)malloc((0x100 * (sizeof(char))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":95 - * cpdef tuple get_usb_strings(): - * cdef char *manufacturer = malloc(256 * sizeof(char)) - * cdef char *product = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) - */ - __pyx_v_product = ((char *)malloc((0x100 * (sizeof(char))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":96 - * cdef char *manufacturer = malloc(256 * sizeof(char)) - * cdef char *product = malloc(256 * sizeof(char)) - * cdef char *serial = malloc(256 * sizeof(char)) # <<<<<<<<<<<<<< - * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) - * if result == 0: - */ - __pyx_v_serial = ((char *)malloc((0x100 * (sizeof(char))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":97 - * cdef char *product = malloc(256 * sizeof(char)) - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) # <<<<<<<<<<<<<< - * if result == 0: - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - */ - __pyx_v_result = rtlsdr_get_usb_strings(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_manufacturer, __pyx_v_product, __pyx_v_serial); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":98 - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) - * if result == 0: # <<<<<<<<<<<<<< - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - */ - __pyx_t_1 = ((__pyx_v_result == 0) != 0); - if (__pyx_t_1) { - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":99 - * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) - * if result == 0: - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') # <<<<<<<<<<<<<< - * else: - * return None, None, None - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_manufacturer, 0, strlen(__pyx_v_manufacturer), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_product, 0, strlen(__pyx_v_product), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_serial, 0, strlen(__pyx_v_serial), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":98 - * cdef char *serial = malloc(256 * sizeof(char)) - * result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) - * if result == 0: # <<<<<<<<<<<<<< - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - */ - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":101 - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - * return None, None, None # <<<<<<<<<<<<<< - * - * cpdef int set_center_freq(uint32_t freq): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_tuple__3); - __pyx_r = __pyx_tuple__3; - goto __pyx_L0; - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":93 - * return None, None - * - * cpdef tuple get_usb_strings(): # <<<<<<<<<<<<<< - * cdef char *manufacturer = malloc(256 * sizeof(char)) - * cdef char *product = malloc(256 * sizeof(char)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_usb_strings", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_17get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_17get_usb_strings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_usb_strings (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_16get_usb_strings(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_16get_usb_strings(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_usb_strings", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_usb_strings(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_usb_strings", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":103 - * return None, None, None - * - * cpdef int set_center_freq(uint32_t freq): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_19set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_center_freq(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_freq, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_center_freq", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":104 - * - * cpdef int set_center_freq(uint32_t freq): - * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) # <<<<<<<<<<<<<< - * - * cpdef uint32_t get_center_freq(): - */ - __pyx_r = rtlsdr_set_center_freq(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_freq); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":103 - * return None, None, None - * - * cpdef int set_center_freq(uint32_t freq): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_19set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_19set_center_freq(PyObject *__pyx_self, PyObject *__pyx_arg_freq) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_freq; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_center_freq (wrapper)", 0); - assert(__pyx_arg_freq); { - __pyx_v_freq = __Pyx_PyInt_As_unsigned_int(__pyx_arg_freq); if (unlikely((__pyx_v_freq == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_center_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_18set_center_freq(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t)__pyx_v_freq)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_18set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_freq) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_center_freq", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_center_freq(__pyx_v_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_center_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":106 - * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) - * - * cpdef uint32_t get_center_freq(): # <<<<<<<<<<<<<< - * """ - * Get actual frequency the device is tuned to. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_21get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_center_freq(CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_center_freq", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":112 - * :return: 0 on error, frequency in Hz otherwise - * """ - * return crtlsdr.rtlsdr_get_center_freq(_c_device) # <<<<<<<<<<<<<< - * - * cpdef int set_freq_correction(int ppm): - */ - __pyx_r = rtlsdr_get_center_freq(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":106 - * return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) - * - * cpdef uint32_t get_center_freq(): # <<<<<<<<<<<<<< - * """ - * Get actual frequency the device is tuned to. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_21get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_20get_center_freq[] = "\n Get actual frequency the device is tuned to.\n\n :return: 0 on error, frequency in Hz otherwise\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_21get_center_freq(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_center_freq (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_20get_center_freq(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_20get_center_freq(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_center_freq", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_center_freq(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_center_freq", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":114 - * return crtlsdr.rtlsdr_get_center_freq(_c_device) - * - * cpdef int set_freq_correction(int ppm): # <<<<<<<<<<<<<< - * """ - * Set the frequency correction value for the device. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_23set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_freq_correction(int __pyx_v_ppm, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_freq_correction", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":121 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) # <<<<<<<<<<<<<< - * - * cpdef int get_freq_correction(): - */ - __pyx_r = rtlsdr_set_freq_correction(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_ppm); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":114 - * return crtlsdr.rtlsdr_get_center_freq(_c_device) - * - * cpdef int set_freq_correction(int ppm): # <<<<<<<<<<<<<< - * """ - * Set the frequency correction value for the device. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_23set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_22set_freq_correction[] = "\n Set the frequency correction value for the device.\n\n :param ppm: ppm correction value in parts per million (ppm)\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_23set_freq_correction(PyObject *__pyx_self, PyObject *__pyx_arg_ppm) { - int __pyx_v_ppm; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_freq_correction (wrapper)", 0); - assert(__pyx_arg_ppm); { - __pyx_v_ppm = __Pyx_PyInt_As_int(__pyx_arg_ppm); if (unlikely((__pyx_v_ppm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_freq_correction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_22set_freq_correction(__pyx_self, ((int)__pyx_v_ppm)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_22set_freq_correction(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ppm) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_freq_correction", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_freq_correction(__pyx_v_ppm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_freq_correction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":123 - * return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) - * - * cpdef int get_freq_correction(): # <<<<<<<<<<<<<< - * """ - * Get actual frequency correction value of the device. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_25get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_freq_correction(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_freq_correction", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":129 - * :return: correction value in parts per million (ppm) - * """ - * return crtlsdr.rtlsdr_get_freq_correction(_c_device) # <<<<<<<<<<<<<< - * - * cpdef crtlsdr.rtlsdr_tuner get_tuner_type(): - */ - __pyx_r = rtlsdr_get_freq_correction(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":123 - * return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) - * - * cpdef int get_freq_correction(): # <<<<<<<<<<<<<< - * """ - * Get actual frequency correction value of the device. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_25get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_24get_freq_correction[] = "\n Get actual frequency correction value of the device.\n\n :return: correction value in parts per million (ppm)\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_25get_freq_correction(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_freq_correction (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_24get_freq_correction(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_24get_freq_correction(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_freq_correction", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_freq_correction(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_freq_correction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":131 - * return crtlsdr.rtlsdr_get_freq_correction(_c_device) - * - * cpdef crtlsdr.rtlsdr_tuner get_tuner_type(): # <<<<<<<<<<<<<< - * """ - * Get the tuner type. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_27get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static rtlsdr_tuner __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_type(CYTHON_UNUSED int __pyx_skip_dispatch) { - rtlsdr_tuner __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_tuner_type", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":137 - * :return: RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise - * """ - * return crtlsdr.rtlsdr_get_tuner_type(_c_device) # <<<<<<<<<<<<<< - * - * cpdef list get_tuner_gains(): - */ - __pyx_r = rtlsdr_get_tuner_type(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":131 - * return crtlsdr.rtlsdr_get_freq_correction(_c_device) - * - * cpdef crtlsdr.rtlsdr_tuner get_tuner_type(): # <<<<<<<<<<<<<< - * """ - * Get the tuner type. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_27get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_26get_tuner_type[] = "\n Get the tuner type.\n\n :return: RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_27get_tuner_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_tuner_type (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_26get_tuner_type(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_26get_tuner_type(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_tuner_type", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_rtlsdr_tuner(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_type(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_tuner_type", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":139 - * return crtlsdr.rtlsdr_get_tuner_type(_c_device) - * - * cpdef list get_tuner_gains(): # <<<<<<<<<<<<<< - * """ - * Get a list of gains supported by the tuner. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_29get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_gains(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_v_num_gains; - int *__pyx_v_gains; - int __pyx_7genexpr__pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("get_tuner_gains", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":147 - * :return: gains array of gain values. In tenths of a dB, 115 means 11.5 dB. - * """ - * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) # <<<<<<<<<<<<<< - * if num_gains < 0: - * return None - */ - __pyx_v_num_gains = rtlsdr_get_tuner_gains(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, NULL); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":148 - * """ - * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) - * if num_gains < 0: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_1 = ((__pyx_v_num_gains < 0) != 0); - if (__pyx_t_1) { - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":149 - * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) - * if num_gains < 0: - * return None # <<<<<<<<<<<<<< - * - * cdef int*gains = malloc(num_gains * sizeof(int)) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":148 - * """ - * cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) - * if num_gains < 0: # <<<<<<<<<<<<<< - * return None - * - */ - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":151 - * return None - * - * cdef int*gains = malloc(num_gains * sizeof(int)) # <<<<<<<<<<<<<< - * crtlsdr.rtlsdr_get_tuner_gains(_c_device, gains) - * - */ - __pyx_v_gains = ((int *)malloc((__pyx_v_num_gains * (sizeof(int))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":152 - * - * cdef int*gains = malloc(num_gains * sizeof(int)) - * crtlsdr.rtlsdr_get_tuner_gains(_c_device, gains) # <<<<<<<<<<<<<< - * - * return [gains[i] for i in range(num_gains)] - */ - (void)(rtlsdr_get_tuner_gains(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_gains)); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":154 - * crtlsdr.rtlsdr_get_tuner_gains(_c_device, gains) - * - * return [gains[i] for i in range(num_gains)] # <<<<<<<<<<<<<< - * - * cpdef int set_tuner_gain(int gain): - */ - __Pyx_XDECREF(__pyx_r); - { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_num_gains; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_7genexpr__pyx_v_i = __pyx_t_5; - __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_gains[__pyx_7genexpr__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } /* exit inner scope */ - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":139 - * return crtlsdr.rtlsdr_get_tuner_type(_c_device) - * - * cpdef list get_tuner_gains(): # <<<<<<<<<<<<<< - * """ - * Get a list of gains supported by the tuner. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_tuner_gains", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_29get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_28get_tuner_gains[] = "\n Get a list of gains supported by the tuner.\n NOTE: The gains argument must be preallocated by the caller. If NULL is\n being given instead, the number of available gain values will be returned.\n\n :return: gains array of gain values. In tenths of a dB, 115 means 11.5 dB.\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_29get_tuner_gains(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_tuner_gains (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_28get_tuner_gains(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_28get_tuner_gains(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_tuner_gains", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_gains(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_tuner_gains", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":156 - * return [gains[i] for i in range(num_gains)] - * - * cpdef int set_tuner_gain(int gain): # <<<<<<<<<<<<<< - * """ - * Set the gain for the device. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_31set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_gain(int __pyx_v_gain, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_tuner_gain", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":170 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) # <<<<<<<<<<<<<< - * - * cpdef int get_tuner_gain(): - */ - __pyx_r = rtlsdr_set_tuner_gain(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_gain); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":156 - * return [gains[i] for i in range(num_gains)] - * - * cpdef int set_tuner_gain(int gain): # <<<<<<<<<<<<<< - * """ - * Set the gain for the device. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_31set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_30set_tuner_gain[] = "\n Set the gain for the device.\n Manual gain mode must be enabled for this to work.\n\n Valid gain values (in tenths of a dB) for the E4000 tuner:\n -10, 15, 40, 65, 90, 115, 140, 165, 190,\n 215, 240, 290, 340, 420, 430, 450, 470, 490\n\n Valid gain values may be queried with rtlsdr_get_tuner_gains function.\n\n :param gain: gain in tenths of a dB, 115 means 11.5 dB.\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_31set_tuner_gain(PyObject *__pyx_self, PyObject *__pyx_arg_gain) { - int __pyx_v_gain; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_tuner_gain (wrapper)", 0); - assert(__pyx_arg_gain); { - __pyx_v_gain = __Pyx_PyInt_As_int(__pyx_arg_gain); if (unlikely((__pyx_v_gain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_tuner_gain", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_30set_tuner_gain(__pyx_self, ((int)__pyx_v_gain)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_30set_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gain) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_tuner_gain", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_gain(__pyx_v_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_tuner_gain", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":172 - * return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) - * - * cpdef int get_tuner_gain(): # <<<<<<<<<<<<<< - * """ - * Get actual gain the device is configured to. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_33get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_gain(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_tuner_gain", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":178 - * :return: 0 on error, gain in tenths of a dB, 115 means 11.5 dB. - * """ - * return crtlsdr.rtlsdr_get_tuner_gain(_c_device) # <<<<<<<<<<<<<< - * - * cpdef int set_tuner_if_gain(int stage, int gain): - */ - __pyx_r = rtlsdr_get_tuner_gain(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":172 - * return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) - * - * cpdef int get_tuner_gain(): # <<<<<<<<<<<<<< - * """ - * Get actual gain the device is configured to. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_33get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_32get_tuner_gain[] = "\n Get actual gain the device is configured to.\n\n :return: 0 on error, gain in tenths of a dB, 115 means 11.5 dB.\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_33get_tuner_gain(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_tuner_gain (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_32get_tuner_gain(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_32get_tuner_gain(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_tuner_gain", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_tuner_gain(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_tuner_gain", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":180 - * return crtlsdr.rtlsdr_get_tuner_gain(_c_device) - * - * cpdef int set_tuner_if_gain(int stage, int gain): # <<<<<<<<<<<<<< - * """ - * Set the intermediate frequency gain for the device. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_35set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_if_gain(int __pyx_v_stage, int __pyx_v_gain, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_tuner_if_gain", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":188 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) # <<<<<<<<<<<<<< - * - * cpdef int set_tuner_gain_mode(int manual): - */ - __pyx_r = rtlsdr_set_tuner_if_gain(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_stage, __pyx_v_gain); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":180 - * return crtlsdr.rtlsdr_get_tuner_gain(_c_device) - * - * cpdef int set_tuner_if_gain(int stage, int gain): # <<<<<<<<<<<<<< - * """ - * Set the intermediate frequency gain for the device. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_35set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_34set_tuner_if_gain[] = "\n Set the intermediate frequency gain for the device.\n\n :param stage: intermediate frequency gain stage number (1 to 6 for E4000)\n :param gain: in tenths of a dB, -30 means -3.0 dB.\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_35set_tuner_if_gain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_stage; - int __pyx_v_gain; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_tuner_if_gain (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stage,&__pyx_n_s_gain,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gain)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set_tuner_if_gain", 1, 2, 2, 1); __PYX_ERR(0, 180, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_tuner_if_gain") < 0)) __PYX_ERR(0, 180, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_stage = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_stage == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) - __pyx_v_gain = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_gain == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_tuner_if_gain", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_tuner_if_gain", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_34set_tuner_if_gain(__pyx_self, __pyx_v_stage, __pyx_v_gain); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_34set_tuner_if_gain(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_stage, int __pyx_v_gain) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_tuner_if_gain", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_if_gain(__pyx_v_stage, __pyx_v_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_tuner_if_gain", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":190 - * return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) - * - * cpdef int set_tuner_gain_mode(int manual): # <<<<<<<<<<<<<< - * """ - * Set the gain mode (automatic/manual) for the device. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_37set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_gain_mode(int __pyx_v_manual, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_tuner_gain_mode", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":198 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_tuner_gain_mode(_c_device, manual) # <<<<<<<<<<<<<< - * - * # cpdef int set_tuner_bandwidth(uint32_t bw): - */ - __pyx_r = rtlsdr_set_tuner_gain_mode(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_manual); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":190 - * return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) - * - * cpdef int set_tuner_gain_mode(int manual): # <<<<<<<<<<<<<< - * """ - * Set the gain mode (automatic/manual) for the device. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_37set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_36set_tuner_gain_mode[] = "\n Set the gain mode (automatic/manual) for the device.\n Manual gain mode must be enabled for the gain setter function to work.\n\n :param manual: 1 means manual gain mode shall be enabled.\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_37set_tuner_gain_mode(PyObject *__pyx_self, PyObject *__pyx_arg_manual) { - int __pyx_v_manual; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_tuner_gain_mode (wrapper)", 0); - assert(__pyx_arg_manual); { - __pyx_v_manual = __Pyx_PyInt_As_int(__pyx_arg_manual); if (unlikely((__pyx_v_manual == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_tuner_gain_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_36set_tuner_gain_mode(__pyx_self, ((int)__pyx_v_manual)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_36set_tuner_gain_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_manual) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_tuner_gain_mode", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_tuner_gain_mode(__pyx_v_manual, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_tuner_gain_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":209 - * # crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) - * - * cpdef int set_sample_rate(uint32_t sample_rate): # <<<<<<<<<<<<<< - * """ - * Set the sample rate for the device, also selects the baseband filters - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_39set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_sample_rate(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_sample_rate, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_sample_rate", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":220 - * :return: - * """ - * return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) # <<<<<<<<<<<<<< - * - * cpdef uint32_t get_sample_rate(): - */ - __pyx_r = rtlsdr_set_sample_rate(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_sample_rate); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":209 - * # crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) - * - * cpdef int set_sample_rate(uint32_t sample_rate): # <<<<<<<<<<<<<< - * """ - * Set the sample rate for the device, also selects the baseband filters - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_39set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_38set_sample_rate[] = "\n Set the sample rate for the device, also selects the baseband filters\n according to the requested sample rate for tuners where this is possible.\n\n :param sample_rate: the sample rate to be set, possible values are:\n 225001 - 300000 Hz\n \t\t 900001 - 3200000 Hz\n \t\t sample loss is to be expected for rates > 2400000\n :return:\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_39set_sample_rate(PyObject *__pyx_self, PyObject *__pyx_arg_sample_rate) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_sample_rate; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_sample_rate (wrapper)", 0); - assert(__pyx_arg_sample_rate); { - __pyx_v_sample_rate = __Pyx_PyInt_As_unsigned_int(__pyx_arg_sample_rate); if (unlikely((__pyx_v_sample_rate == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_sample_rate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_38set_sample_rate(__pyx_self, ((__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t)__pyx_v_sample_rate)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_38set_sample_rate(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_v_sample_rate) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_sample_rate", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_sample_rate(__pyx_v_sample_rate, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_sample_rate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":222 - * return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) - * - * cpdef uint32_t get_sample_rate(): # <<<<<<<<<<<<<< - * """ - * Get actual sample rate the device is configured to. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_41get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_sample_rate(CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint32_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sample_rate", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":227 - * :return: 0 on error, sample rate in Hz otherwise - * """ - * return crtlsdr.rtlsdr_get_sample_rate(_c_device) # <<<<<<<<<<<<<< - * - * cpdef int set_agc_mode(int on): - */ - __pyx_r = rtlsdr_get_sample_rate(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":222 - * return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) - * - * cpdef uint32_t get_sample_rate(): # <<<<<<<<<<<<<< - * """ - * Get actual sample rate the device is configured to. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_41get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_40get_sample_rate[] = "\n Get actual sample rate the device is configured to.\n :return: 0 on error, sample rate in Hz otherwise\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_41get_sample_rate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sample_rate (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_40get_sample_rate(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_40get_sample_rate(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_sample_rate", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_sample_rate(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_sample_rate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":229 - * return crtlsdr.rtlsdr_get_sample_rate(_c_device) - * - * cpdef int set_agc_mode(int on): # <<<<<<<<<<<<<< - * """ - * Enable or disable the internal digital Automatic Gain Control of the RTL2832. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_43set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_agc_mode(int __pyx_v_on, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_agc_mode", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":236 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) # <<<<<<<<<<<<<< - * - * cpdef int set_direct_sampling(int on): - */ - __pyx_r = rtlsdr_set_agc_mode(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_on); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":229 - * return crtlsdr.rtlsdr_get_sample_rate(_c_device) - * - * cpdef int set_agc_mode(int on): # <<<<<<<<<<<<<< - * """ - * Enable or disable the internal digital Automatic Gain Control of the RTL2832. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_43set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_42set_agc_mode[] = "\n Enable or disable the internal digital Automatic Gain Control of the RTL2832.\n\n :param on: digital AGC mode, 1 means enabled, 0 disabled\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_43set_agc_mode(PyObject *__pyx_self, PyObject *__pyx_arg_on) { - int __pyx_v_on; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_agc_mode (wrapper)", 0); - assert(__pyx_arg_on); { - __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_agc_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_42set_agc_mode(__pyx_self, ((int)__pyx_v_on)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_42set_agc_mode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_agc_mode", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_agc_mode(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_agc_mode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":238 - * return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) - * - * cpdef int set_direct_sampling(int on): # <<<<<<<<<<<<<< - * """ - * Enable or disable the direct sampling mode. When enabled, the IF mode - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_45set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_direct_sampling(int __pyx_v_on, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_direct_sampling", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":248 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) # <<<<<<<<<<<<<< - * - * cpdef int get_direct_sampling(): - */ - __pyx_r = rtlsdr_set_direct_sampling(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_on); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":238 - * return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) - * - * cpdef int set_direct_sampling(int on): # <<<<<<<<<<<<<< - * """ - * Enable or disable the direct sampling mode. When enabled, the IF mode - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_45set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_44set_direct_sampling[] = "\n Enable or disable the direct sampling mode. When enabled, the IF mode\n of the RTL2832 is activated, and rtlsdr_set_center_freq() will control\n the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz\n (xtal frequency of the RTL2832).\n\n :param on: 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_45set_direct_sampling(PyObject *__pyx_self, PyObject *__pyx_arg_on) { - int __pyx_v_on; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_direct_sampling (wrapper)", 0); - assert(__pyx_arg_on); { - __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_direct_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_44set_direct_sampling(__pyx_self, ((int)__pyx_v_on)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_44set_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_direct_sampling", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_direct_sampling(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_direct_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":250 - * return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) - * - * cpdef int get_direct_sampling(): # <<<<<<<<<<<<<< - * """ - * Get state of the direct sampling mode - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_47get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_direct_sampling(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_direct_sampling", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":256 - * :return: -1 on error, 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled - * """ - * return crtlsdr.rtlsdr_get_direct_sampling(_c_device) # <<<<<<<<<<<<<< - * - * cpdef int set_offset_tuning(int on): - */ - __pyx_r = rtlsdr_get_direct_sampling(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":250 - * return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) - * - * cpdef int get_direct_sampling(): # <<<<<<<<<<<<<< - * """ - * Get state of the direct sampling mode - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_47get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_46get_direct_sampling[] = "\n Get state of the direct sampling mode\n\n :return: -1 on error, 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_47get_direct_sampling(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_direct_sampling (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_46get_direct_sampling(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_46get_direct_sampling(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_direct_sampling", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_direct_sampling(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_direct_sampling", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":258 - * return crtlsdr.rtlsdr_get_direct_sampling(_c_device) - * - * cpdef int set_offset_tuning(int on): # <<<<<<<<<<<<<< - * """ - * Enable or disable offset tuning for zero-IF tuners, which allows to avoid - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_49set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_offset_tuning(int __pyx_v_on, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_offset_tuning", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":266 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) # <<<<<<<<<<<<<< - * - * cpdef int get_offset_tuning(): - */ - __pyx_r = rtlsdr_set_offset_tuning(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_v_on); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":258 - * return crtlsdr.rtlsdr_get_direct_sampling(_c_device) - * - * cpdef int set_offset_tuning(int on): # <<<<<<<<<<<<<< - * """ - * Enable or disable offset tuning for zero-IF tuners, which allows to avoid - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_49set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_48set_offset_tuning[] = "\n Enable or disable offset tuning for zero-IF tuners, which allows to avoid\n problems caused by the DC offset of the ADCs and 1/f noise.\n\n :param on: 0 means disabled, 1 enabled\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_49set_offset_tuning(PyObject *__pyx_self, PyObject *__pyx_arg_on) { - int __pyx_v_on; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_offset_tuning (wrapper)", 0); - assert(__pyx_arg_on); { - __pyx_v_on = __Pyx_PyInt_As_int(__pyx_arg_on); if (unlikely((__pyx_v_on == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_offset_tuning", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_48set_offset_tuning(__pyx_self, ((int)__pyx_v_on)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_48set_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_on) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("set_offset_tuning", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_set_offset_tuning(__pyx_v_on, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.set_offset_tuning", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":268 - * return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) - * - * cpdef int get_offset_tuning(): # <<<<<<<<<<<<<< - * """ - * Get state of the offset tuning mode - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_51get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_offset_tuning(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_offset_tuning", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":274 - * :return: -1 on error, 0 means disabled, 1 enabled - * """ - * return crtlsdr.rtlsdr_get_offset_tuning(_c_device) # <<<<<<<<<<<<<< - * - * cpdef int reset_buffer(): - */ - __pyx_r = rtlsdr_get_offset_tuning(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":268 - * return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) - * - * cpdef int get_offset_tuning(): # <<<<<<<<<<<<<< - * """ - * Get state of the offset tuning mode - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_51get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_50get_offset_tuning[] = "\n Get state of the offset tuning mode\n\n :return: -1 on error, 0 means disabled, 1 enabled\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_51get_offset_tuning(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_offset_tuning (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_50get_offset_tuning(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_50get_offset_tuning(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_offset_tuning", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_get_offset_tuning(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.get_offset_tuning", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":276 - * return crtlsdr.rtlsdr_get_offset_tuning(_c_device) - * - * cpdef int reset_buffer(): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_reset_buffer(_c_device) - * - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_53reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_reset_buffer(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset_buffer", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":277 - * - * cpdef int reset_buffer(): - * return crtlsdr.rtlsdr_reset_buffer(_c_device) # <<<<<<<<<<<<<< - * - * cpdef bytes read_sync(int num_samples=8 * 32 * 512): - */ - __pyx_r = rtlsdr_reset_buffer(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":276 - * return crtlsdr.rtlsdr_get_offset_tuning(_c_device) - * - * cpdef int reset_buffer(): # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_reset_buffer(_c_device) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_53reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_53reset_buffer(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset_buffer (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_52reset_buffer(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_52reset_buffer(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("reset_buffer", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_reset_buffer(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.reset_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":279 - * return crtlsdr.rtlsdr_reset_buffer(_c_device) - * - * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< - * """ - * The raw, captured IQ data is 8 bit unsigned data. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_55read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync *__pyx_optional_args) { - int __pyx_v_num_samples = __pyx_k__4; - __pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint8_t *__pyx_v_samples; - int __pyx_v_n_read; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - __Pyx_RefNannySetupContext("read_sync", 0); - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_num_samples = __pyx_optional_args->num_samples; - } - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":285 - * :return: - * """ - * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) # <<<<<<<<<<<<<< - * if not samples: - * raise MemoryError() - */ - __pyx_v_samples = ((__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint8_t *)malloc(((2 * __pyx_v_num_samples) * (sizeof(__pyx_t_3urh_3dev_6native_3lib_15rtlsdr_fallback_uint8_t))))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":286 - * """ - * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) - * if not samples: # <<<<<<<<<<<<<< - * raise MemoryError() - * - */ - __pyx_t_1 = ((!(__pyx_v_samples != 0)) != 0); - if (unlikely(__pyx_t_1)) { - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":287 - * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) - * if not samples: - * raise MemoryError() # <<<<<<<<<<<<<< - * - * cdef int n_read = 0 - */ - PyErr_NoMemory(); __PYX_ERR(0, 287, __pyx_L1_error) - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":286 - * """ - * cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) - * if not samples: # <<<<<<<<<<<<<< - * raise MemoryError() - * - */ - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":289 - * raise MemoryError() - * - * cdef int n_read = 0 # <<<<<<<<<<<<<< - * try: - * crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) - */ - __pyx_v_n_read = 0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":290 - * - * cdef int n_read = 0 - * try: # <<<<<<<<<<<<<< - * crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) - * return bytes(samples[0:n_read]) - */ - /*try:*/ { - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":291 - * cdef int n_read = 0 - * try: - * crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) # <<<<<<<<<<<<<< - * return bytes(samples[0:n_read]) - * finally: - */ - (void)(rtlsdr_read_sync(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, ((void *)__pyx_v_samples), __pyx_v_num_samples, (&__pyx_v_n_read))); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":292 - * try: - * crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) - * return bytes(samples[0:n_read]) # <<<<<<<<<<<<<< - * finally: - * free(samples) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_samples) + 0, __pyx_v_n_read - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L4_return; - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":294 - * return bytes(samples[0:n_read]) - * finally: - * free(samples) # <<<<<<<<<<<<<< - * - * cpdef int read_async(callback, connection): - */ - /*finally:*/ { - __pyx_L5_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - free(__pyx_v_samples); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L4_return: { - __pyx_t_13 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_samples); - __pyx_r = __pyx_t_13; - __pyx_t_13 = 0; - goto __pyx_L0; - } - } - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":279 - * return crtlsdr.rtlsdr_reset_buffer(_c_device) - * - * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< - * """ - * The raw, captured IQ data is 8 bit unsigned data. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.read_sync", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_55read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_54read_sync[] = "\n The raw, captured IQ data is 8 bit unsigned data.\n\n :return:\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_55read_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_num_samples; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_sync (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num_samples,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_samples); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_sync") < 0)) __PYX_ERR(0, 279, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - if (values[0]) { - __pyx_v_num_samples = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L3_error) - } else { - __pyx_v_num_samples = __pyx_k__4; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_sync", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 279, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.read_sync", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_54read_sync(__pyx_self, __pyx_v_num_samples); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_54read_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_num_samples) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync __pyx_t_2; - __Pyx_RefNannySetupContext("read_sync", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_2.__pyx_n = 1; - __pyx_t_2.num_samples = __pyx_v_num_samples; - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_sync(0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.read_sync", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":296 - * free(samples) - * - * cpdef int read_async(callback, connection): # <<<<<<<<<<<<<< - * """ - * Read samples from the device asynchronously. This function will block until - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_57read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_async(PyObject *__pyx_v_callback, PyObject *__pyx_v_connection, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_async", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":304 - * """ - * global f - * f = callback # <<<<<<<<<<<<<< - * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) - * - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f, __pyx_v_callback) < 0) __PYX_ERR(0, 304, __pyx_L1_error) - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":305 - * global f - * f = callback - * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) # <<<<<<<<<<<<<< - * - * cpdef int cancel_async(): - */ - __pyx_r = rtlsdr_read_async(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device, __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_callback_recv, ((void *)__pyx_v_connection), 0, 0); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":296 - * free(samples) - * - * cpdef int read_async(callback, connection): # <<<<<<<<<<<<<< - * """ - * Read samples from the device asynchronously. This function will block until - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_WriteUnraisable("urh.dev.native.lib.rtlsdr_fallback.read_async", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_57read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_56read_async[] = "\n Read samples from the device asynchronously. This function will block until\n it is being canceled using rtlsdr_cancel_async()\n read_bytes_async\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_57read_async(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_v_connection = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_async (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,&__pyx_n_s_connection,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_async", 1, 2, 2, 1); __PYX_ERR(0, 296, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_async") < 0)) __PYX_ERR(0, 296, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_callback = values[0]; - __pyx_v_connection = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_async", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 296, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.read_async", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_56read_async(__pyx_self, __pyx_v_callback, __pyx_v_connection); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_56read_async(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_connection) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("read_async", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_read_async(__pyx_v_callback, __pyx_v_connection, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.read_async", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "urh/dev/native/lib/rtlsdr_fallback.pyx":307 - * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) - * - * cpdef int cancel_async(): # <<<<<<<<<<<<<< - * """ - * Cancel all pending asynchronous operations on the device. - */ - -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_59cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_cancel_async(CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("cancel_async", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":313 - * :return: 0 on success - * """ - * return crtlsdr.rtlsdr_cancel_async(_c_device) # <<<<<<<<<<<<<< - */ - __pyx_r = rtlsdr_cancel_async(__pyx_v_3urh_3dev_6native_3lib_15rtlsdr_fallback__c_device); - goto __pyx_L0; - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":307 - * return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) - * - * cpdef int cancel_async(): # <<<<<<<<<<<<<< - * """ - * Cancel all pending asynchronous operations on the device. - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_59cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_58cancel_async[] = "\n Cancel all pending asynchronous operations on the device.\n\n :return: 0 on success\n "; -static PyObject *__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_59cancel_async(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("cancel_async (wrapper)", 0); - __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_58cancel_async(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_3urh_3dev_6native_3lib_15rtlsdr_fallback_58cancel_async(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("cancel_async", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3urh_3dev_6native_3lib_15rtlsdr_fallback_cancel_async(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("urh.dev.native.lib.rtlsdr_fallback.cancel_async", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {"get_device_count", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_1get_device_count, METH_NOARGS, 0}, - {"get_device_name", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_3get_device_name, METH_O, 0}, - {"get_device_usb_strings", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_5get_device_usb_strings, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_4get_device_usb_strings}, - {"get_index_by_serial", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_7get_index_by_serial, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_6get_index_by_serial}, - {"open", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_9open, METH_O, 0}, - {"close", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_11close, METH_NOARGS, 0}, - {"set_xtal_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_13set_xtal_freq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_12set_xtal_freq}, - {"get_xtal_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_15get_xtal_freq, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_14get_xtal_freq}, - {"get_usb_strings", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_17get_usb_strings, METH_NOARGS, 0}, - {"set_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_19set_center_freq, METH_O, 0}, - {"get_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_21get_center_freq, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_20get_center_freq}, - {"set_freq_correction", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_23set_freq_correction, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_22set_freq_correction}, - {"get_freq_correction", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_25get_freq_correction, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_24get_freq_correction}, - {"get_tuner_type", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_27get_tuner_type, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_26get_tuner_type}, - {"get_tuner_gains", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_29get_tuner_gains, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_28get_tuner_gains}, - {"set_tuner_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_31set_tuner_gain, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_30set_tuner_gain}, - {"get_tuner_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_33get_tuner_gain, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_32get_tuner_gain}, - {"set_tuner_if_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_35set_tuner_if_gain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_34set_tuner_if_gain}, - {"set_tuner_gain_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_37set_tuner_gain_mode, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_36set_tuner_gain_mode}, - {"set_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_39set_sample_rate, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_38set_sample_rate}, - {"get_sample_rate", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_41get_sample_rate, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_40get_sample_rate}, - {"set_agc_mode", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_43set_agc_mode, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_42set_agc_mode}, - {"set_direct_sampling", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_45set_direct_sampling, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_44set_direct_sampling}, - {"get_direct_sampling", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_47get_direct_sampling, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_46get_direct_sampling}, - {"set_offset_tuning", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_49set_offset_tuning, METH_O, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_48set_offset_tuning}, - {"get_offset_tuning", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_51get_offset_tuning, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_50get_offset_tuning}, - {"reset_buffer", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_53reset_buffer, METH_NOARGS, 0}, - {"read_sync", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_55read_sync, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_54read_sync}, - {"read_async", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_57read_async, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_56read_async}, - {"cancel_async", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_15rtlsdr_fallback_59cancel_async, METH_NOARGS, __pyx_doc_3urh_3dev_6native_3lib_15rtlsdr_fallback_58cancel_async}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_rtlsdr_fallback(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_rtlsdr_fallback}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "rtlsdr_fallback", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_n_s_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_connection, __pyx_k_connection, sizeof(__pyx_k_connection), 0, 0, 1, 1}, - {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, - {&__pyx_n_s_gain, __pyx_k_gain, sizeof(__pyx_k_gain), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_num_samples, __pyx_k_num_samples, sizeof(__pyx_k_num_samples), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_rtl_freq, __pyx_k_rtl_freq, sizeof(__pyx_k_rtl_freq), 0, 0, 1, 1}, - {&__pyx_n_s_stage, __pyx_k_stage, sizeof(__pyx_k_stage), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tuner_freq, __pyx_k_tuner_freq, sizeof(__pyx_k_tuner_freq), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 154, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 287, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":39 - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - * return None, None, None # <<<<<<<<<<<<<< - * - * cpdef int get_index_by_serial(str serial): - */ - __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":91 - * return rtl_freq, tuner_freq - * else: - * return None, None # <<<<<<<<<<<<<< - * - * cpdef tuple get_usb_strings(): - */ - __pyx_tuple__2 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":101 - * return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - * else: - * return None, None, None # <<<<<<<<<<<<<< - * - * cpdef int set_center_freq(uint32_t freq): - */ - __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_modinit_global_init_code(void); /*proto*/ -static int __Pyx_modinit_variable_export_code(void); /*proto*/ -static int __Pyx_modinit_function_export_code(void); /*proto*/ -static int __Pyx_modinit_type_init_code(void); /*proto*/ -static int __Pyx_modinit_type_import_code(void); /*proto*/ -static int __Pyx_modinit_variable_import_code(void); /*proto*/ -static int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) - #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initrtlsdr_fallback(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initrtlsdr_fallback(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_rtlsdr_fallback(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_rtlsdr_fallback(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - result = PyDict_SetItemString(moddict, to_name, value); - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static int __pyx_pymod_exec_rtlsdr_fallback(PyObject *__pyx_pyinit_module) CYTHON_SMALL_CODE -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_rtlsdr_fallback(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("rtlsdr_fallback", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_urh__dev__native__lib__rtlsdr_fallback) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "urh.dev.native.lib.rtlsdr_fallback")) { - if (unlikely(PyDict_SetItemString(modules, "urh.dev.native.lib.rtlsdr_fallback", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":279 - * return crtlsdr.rtlsdr_reset_buffer(_c_device) - * - * cpdef bytes read_sync(int num_samples=8 * 32 * 512): # <<<<<<<<<<<<<< - * """ - * The raw, captured IQ data is 8 bit unsigned data. - */ - __pyx_k__4 = ((8 * 32) * 0x200); - __pyx_k__4 = ((8 * 32) * 0x200); - - /* "urh/dev/native/lib/rtlsdr_fallback.pyx":1 - * # cython wrapper for RTL-SDR (https://github.com/pinkavaj/rtl-sdr) # <<<<<<<<<<<<<< - * # this fallback does not include set_tuner_bandwidth , as it is not supported e.g. in Manjaro and Ubuntu packages - * - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init urh.dev.native.lib.rtlsdr_fallback", 0, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init urh.dev.native.lib.rtlsdr_fallback"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - if (likely(result)) { - Py_INCREF(result); - } else if (unlikely(PyErr_Occurred())) { - result = NULL; - } else { -#else - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); - } -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* WriteUnraisableException */ - static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* ArgTypeTest */ - static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -/* RaiseArgTupleInvalid */ - static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ - static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ - static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { -#endif - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = local_type; - tstate->exc_state.exc_value = local_value; - tstate->exc_state.exc_traceback = local_tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = *type; - tstate->exc_state.exc_value = *value; - tstate->exc_state.exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A2 - *type = tstate->exc_state.exc_type; - *value = tstate->exc_state.exc_value; - *tb = tstate->exc_state.exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = type; - tstate->exc_state.exc_value = value; - tstate->exc_state.exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (PyObject_Not(use_cline) != 0) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { - const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(unsigned int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(unsigned int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(unsigned int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_rtlsdr_tuner(rtlsdr_tuner value) { - const rtlsdr_tuner neg_one = (rtlsdr_tuner) -1, const_zero = (rtlsdr_tuner) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(rtlsdr_tuner) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(rtlsdr_tuner) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(rtlsdr_tuner) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(rtlsdr_tuner) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(rtlsdr_tuner) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(rtlsdr_tuner), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { - const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(unsigned int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (unsigned int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (unsigned int) 0; - case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0]) - case 2: - if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { - return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { - return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) { - return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (unsigned int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(unsigned int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (unsigned int) 0; - case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) - case -2: - if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { - return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { - return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { - return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { - return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { - return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { - return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(unsigned int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - unsigned int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (unsigned int) -1; - } - } else { - unsigned int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (unsigned int) -1; - val = __Pyx_PyInt_As_unsigned_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to unsigned int"); - return (unsigned int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned int"); - return (unsigned int) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { - if (likely(err == exc_type)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); - } - return PyErr_GivenExceptionMatches(err, exc_type); -} -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); - } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); -} -#endif - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { - Py_DECREF(result); - return NULL; - } - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/urh/dev/native/lib/rtlsdr_fallback.pyx b/src/urh/dev/native/lib/rtlsdr_fallback.pyx deleted file mode 100644 index 366d6a1a4f..0000000000 --- a/src/urh/dev/native/lib/rtlsdr_fallback.pyx +++ /dev/null @@ -1,313 +0,0 @@ -# cython wrapper for RTL-SDR (https://github.com/pinkavaj/rtl-sdr) -# this fallback does not include set_tuner_bandwidth , as it is not supported e.g. in Manjaro and Ubuntu packages - -cimport crtlsdr -from libc.stdlib cimport malloc, free - -ctypedef unsigned char uint8_t -ctypedef unsigned short uint16_t -ctypedef unsigned int uint32_t -ctypedef unsigned long long uint64_t - -cdef crtlsdr.rtlsdr_dev_t*_c_device - -cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx): - global f - conn = ctx - (f)(buffer[0:length]) - - -cpdef uint32_t get_device_count(): - return crtlsdr.rtlsdr_get_device_count() - -cpdef str get_device_name(uint32_t index): - return crtlsdr.rtlsdr_get_device_name(index).decode('UTF-8') - -cpdef tuple get_device_usb_strings(uint32_t index): - """ - - :param index: index of the device - :return: manufacturer name, product name, serial serial number on success else None, None, None - """ - cdef char *manufacturer = malloc(256 * sizeof(char)) - cdef char *product = malloc(256 * sizeof(char)) - cdef char *serial = malloc(256 * sizeof(char)) - result = crtlsdr.rtlsdr_get_device_usb_strings(index, manufacturer, product, serial) - if result == 0: - return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - else: - return None, None, None - -cpdef int get_index_by_serial(str serial): - """ - Get device index by USB serial string descriptor. - - :param serial: serial string of the device - :return: device index of first device where the name matched - -1 if name is NULL - -2 if no devices were found at all - -3 if devices were found, but none with matching name - """ - serial_byte_string = serial.encode('UTF-8') - return crtlsdr.rtlsdr_get_index_by_serial( serial_byte_string) - -cpdef int open(uint32_t index): - return crtlsdr.rtlsdr_open(&_c_device, index) - -cpdef int close(): - return crtlsdr.rtlsdr_close(_c_device) - -cpdef int set_xtal_freq(uint32_t rtl_freq, uint32_t tuner_freq): - """ - Set crystal oscillator frequencies used for the RTL2832 and the tuner IC. - - Usually both ICs use the same clock. Changing the clock may make sense if - you are applying an external clock to the tuner or to compensate the - frequency (and samplerate) error caused by the original (cheap) crystal. - - NOTE: Call this function only if you fully understand the implications. - - :param rtl_freq: frequency value used to clock the RTL2832 in Hz - :param tuner_freq: frequency value used to clock the tuner IC in Hz - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_xtal_freq(_c_device, rtl_freq, tuner_freq) - -cpdef tuple get_xtal_freq(): - """ - Get crystal oscillator frequencies used for the RTL2832 and the tuner IC. - Usually both ICs use the same clock. - - :return: rtl_freq frequency value used to clock the RTL2832 in Hz, - tuner_freq frequency value used to clock the tuner IC in Hz - """ - cdef uint32_t rtl_freq = 0 - cdef uint32_t tuner_freq = 0 - result = crtlsdr.rtlsdr_get_xtal_freq(_c_device, &rtl_freq, &tuner_freq) - - if result == 0: - return rtl_freq, tuner_freq - else: - return None, None - -cpdef tuple get_usb_strings(): - cdef char *manufacturer = malloc(256 * sizeof(char)) - cdef char *product = malloc(256 * sizeof(char)) - cdef char *serial = malloc(256 * sizeof(char)) - result = crtlsdr.rtlsdr_get_usb_strings(_c_device, manufacturer, product, serial) - if result == 0: - return manufacturer.decode('UTF-8'), product.decode('UTF-8'), serial.decode('UTF-8') - else: - return None, None, None - -cpdef int set_center_freq(uint32_t freq): - return crtlsdr.rtlsdr_set_center_freq(_c_device, freq) - -cpdef uint32_t get_center_freq(): - """ - Get actual frequency the device is tuned to. - - :return: 0 on error, frequency in Hz otherwise - """ - return crtlsdr.rtlsdr_get_center_freq(_c_device) - -cpdef int set_freq_correction(int ppm): - """ - Set the frequency correction value for the device. - - :param ppm: ppm correction value in parts per million (ppm) - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_freq_correction(_c_device, ppm) - -cpdef int get_freq_correction(): - """ - Get actual frequency correction value of the device. - - :return: correction value in parts per million (ppm) - """ - return crtlsdr.rtlsdr_get_freq_correction(_c_device) - -cpdef crtlsdr.rtlsdr_tuner get_tuner_type(): - """ - Get the tuner type. - - :return: RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise - """ - return crtlsdr.rtlsdr_get_tuner_type(_c_device) - -cpdef list get_tuner_gains(): - """ - Get a list of gains supported by the tuner. - NOTE: The gains argument must be preallocated by the caller. If NULL is - being given instead, the number of available gain values will be returned. - - :return: gains array of gain values. In tenths of a dB, 115 means 11.5 dB. - """ - cdef int num_gains = crtlsdr.rtlsdr_get_tuner_gains(_c_device, NULL) - if num_gains < 0: - return None - - cdef int*gains = malloc(num_gains * sizeof(int)) - crtlsdr.rtlsdr_get_tuner_gains(_c_device, gains) - - return [gains[i] for i in range(num_gains)] - -cpdef int set_tuner_gain(int gain): - """ - Set the gain for the device. - Manual gain mode must be enabled for this to work. - - Valid gain values (in tenths of a dB) for the E4000 tuner: - -10, 15, 40, 65, 90, 115, 140, 165, 190, - 215, 240, 290, 340, 420, 430, 450, 470, 490 - - Valid gain values may be queried with rtlsdr_get_tuner_gains function. - - :param gain: gain in tenths of a dB, 115 means 11.5 dB. - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_tuner_gain(_c_device, gain) - -cpdef int get_tuner_gain(): - """ - Get actual gain the device is configured to. - - :return: 0 on error, gain in tenths of a dB, 115 means 11.5 dB. - """ - return crtlsdr.rtlsdr_get_tuner_gain(_c_device) - -cpdef int set_tuner_if_gain(int stage, int gain): - """ - Set the intermediate frequency gain for the device. - - :param stage: intermediate frequency gain stage number (1 to 6 for E4000) - :param gain: in tenths of a dB, -30 means -3.0 dB. - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_tuner_if_gain(_c_device, stage, gain) - -cpdef int set_tuner_gain_mode(int manual): - """ - Set the gain mode (automatic/manual) for the device. - Manual gain mode must be enabled for the gain setter function to work. - - :param manual: 1 means manual gain mode shall be enabled. - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_tuner_gain_mode(_c_device, manual) - -# cpdef int set_tuner_bandwidth(uint32_t bw): -# """ -# Set the bandwidth for the device. -# -# :param bw: bandwidth in Hz. Zero means automatic BW selection. -# :return 0 on success -# """ -# crtlsdr.rtlsdr_set_tuner_bandwidth(_c_device, bw) - -cpdef int set_sample_rate(uint32_t sample_rate): - """ - Set the sample rate for the device, also selects the baseband filters - according to the requested sample rate for tuners where this is possible. - - :param sample_rate: the sample rate to be set, possible values are: - 225001 - 300000 Hz - 900001 - 3200000 Hz - sample loss is to be expected for rates > 2400000 - :return: - """ - return crtlsdr.rtlsdr_set_sample_rate(_c_device, sample_rate) - -cpdef uint32_t get_sample_rate(): - """ - Get actual sample rate the device is configured to. - :return: 0 on error, sample rate in Hz otherwise - """ - return crtlsdr.rtlsdr_get_sample_rate(_c_device) - -cpdef int set_agc_mode(int on): - """ - Enable or disable the internal digital Automatic Gain Control of the RTL2832. - - :param on: digital AGC mode, 1 means enabled, 0 disabled - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_agc_mode(_c_device, on) - -cpdef int set_direct_sampling(int on): - """ - Enable or disable the direct sampling mode. When enabled, the IF mode - of the RTL2832 is activated, and rtlsdr_set_center_freq() will control - the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz - (xtal frequency of the RTL2832). - - :param on: 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_direct_sampling(_c_device, on) - -cpdef int get_direct_sampling(): - """ - Get state of the direct sampling mode - - :return: -1 on error, 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled - """ - return crtlsdr.rtlsdr_get_direct_sampling(_c_device) - -cpdef int set_offset_tuning(int on): - """ - Enable or disable offset tuning for zero-IF tuners, which allows to avoid - problems caused by the DC offset of the ADCs and 1/f noise. - - :param on: 0 means disabled, 1 enabled - :return: 0 on success - """ - return crtlsdr.rtlsdr_set_offset_tuning(_c_device, on) - -cpdef int get_offset_tuning(): - """ - Get state of the offset tuning mode - - :return: -1 on error, 0 means disabled, 1 enabled - """ - return crtlsdr.rtlsdr_get_offset_tuning(_c_device) - -cpdef int reset_buffer(): - return crtlsdr.rtlsdr_reset_buffer(_c_device) - -cpdef bytes read_sync(int num_samples=8 * 32 * 512): - """ - The raw, captured IQ data is 8 bit unsigned data. - - :return: - """ - cdef uint8_t *samples = malloc(2*num_samples * sizeof(uint8_t)) - if not samples: - raise MemoryError() - - cdef int n_read = 0 - try: - crtlsdr.rtlsdr_read_sync(_c_device, samples, num_samples, &n_read) - return bytes(samples[0:n_read]) - finally: - free(samples) - -cpdef int read_async(callback, connection): - """ - Read samples from the device asynchronously. This function will block until - it is being canceled using rtlsdr_cancel_async() - read_bytes_async - :return: 0 on success - """ - global f - f = callback - return crtlsdr.rtlsdr_read_async(_c_device, _c_callback_recv, connection, 0, 0) - -cpdef int cancel_async(): - """ - Cancel all pending asynchronous operations on the device. - - :return: 0 on success - """ - return crtlsdr.rtlsdr_cancel_async(_c_device) diff --git a/src/urh/dev/native/lib/usrp.c b/src/urh/dev/native/lib/usrp.c index 01eae59b13..a1d5c79d0a 100644 --- a/src/urh/dev/native/lib/usrp.c +++ b/src/urh/dev/native/lib/usrp.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.28 */ +/* Generated by Cython 0.28.2 */ /* BEGIN: Cython Metadata { @@ -37,7 +37,7 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_28" +#define CYTHON_ABI "0_28_2" #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -1570,6 +1570,29 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); @@ -1713,23 +1736,6 @@ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { #endif } -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); @@ -2128,6 +2134,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(double, int static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(double, int __pyx_skip_dispatch); /*proto*/ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_find_devices(PyObject *, int __pyx_skip_dispatch); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -2170,6 +2177,7 @@ int __pyx_module_is_main_urh__dev__native__lib__usrp = 0; /* Implementation of 'urh.dev.native.lib.usrp' */ static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_ImportError; @@ -2178,14 +2186,14 @@ static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static const char __pyx_k_[] = ""; static const char __pyx_k_O[] = "O"; static const char __pyx_k_T[] = "T{"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_s[] = "(%s)"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; - static const char __pyx_k__31[] = "^"; - static const char __pyx_k__32[] = ""; + static const char __pyx_k__32[] = "^"; static const char __pyx_k__33[] = ":"; static const char __pyx_k__34[] = "}"; static const char __pyx_k__35[] = ","; @@ -2209,6 +2217,7 @@ static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; static const char __pyx_k_numpy[] = "numpy"; +static const char __pyx_k_print[] = "print"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_start[] = "start"; @@ -2288,6 +2297,8 @@ static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __red static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; +static PyObject *__pyx_kp_b_; +static PyObject *__pyx_kp_u_; static PyObject *__pyx_n_s_ASCII; static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; @@ -2317,7 +2328,6 @@ static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_View_MemoryView; -static PyObject *__pyx_kp_b__31; static PyObject *__pyx_kp_b__32; static PyObject *__pyx_kp_b__33; static PyObject *__pyx_kp_b__34; @@ -2367,6 +2377,7 @@ static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_pack; static PyObject *__pyx_n_s_pickle; +static PyObject *__pyx_n_s_print; static PyObject *__pyx_n_s_pyx_PickleError; static PyObject *__pyx_n_s_pyx_checksum; static PyObject *__pyx_n_s_pyx_getbuffer; @@ -2416,6 +2427,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_24set_bandwidth(CYTHON_UN static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_26set_rf_gain(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_normalized_gain); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_28set_center_freq(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_center_freq); /* proto */ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_30get_last_error(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_32find_devices(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ @@ -2468,7 +2480,6 @@ static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_184977713; static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; @@ -2477,9 +2488,9 @@ static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__25; static PyObject *__pyx_slice__26; static PyObject *__pyx_slice__27; +static PyObject *__pyx_slice__28; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; @@ -2495,9 +2506,10 @@ static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__31; static PyObject *__pyx_tuple__36; static PyObject *__pyx_tuple__37; static PyObject *__pyx_tuple__38; @@ -2679,8 +2691,8 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_2set_channel(CYTHON_UNUSE * CHANNEL = channel * * cpdef uhd_error open(str device_args): # <<<<<<<<<<<<<< - * py_byte_string = device_args.encode('UTF-8') - * cdef char* dev_args = py_byte_string + * if not device_args: + * device_args = "" */ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_5open(PyObject *__pyx_self, PyObject *__pyx_v_device_args); /*proto*/ @@ -2689,37 +2701,70 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_open(PyObject *__pyx_v_dev char *__pyx_v_dev_args; uhd_error __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; __Pyx_RefNannySetupContext("open", 0); + __Pyx_INCREF(__pyx_v_device_args); /* "urh/dev/native/lib/usrp.pyx":32 * * cpdef uhd_error open(str device_args): + * if not device_args: # <<<<<<<<<<<<<< + * device_args = "" + * py_byte_string = device_args.encode('UTF-8') + */ + __pyx_t_1 = (__pyx_v_device_args != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_device_args) != 0); + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { + + /* "urh/dev/native/lib/usrp.pyx":33 + * cpdef uhd_error open(str device_args): + * if not device_args: + * device_args = "" # <<<<<<<<<<<<<< + * py_byte_string = device_args.encode('UTF-8') + * cdef char* dev_args = py_byte_string + */ + __Pyx_INCREF(__pyx_kp_u_); + __Pyx_DECREF_SET(__pyx_v_device_args, __pyx_kp_u_); + + /* "urh/dev/native/lib/usrp.pyx":32 + * + * cpdef uhd_error open(str device_args): + * if not device_args: # <<<<<<<<<<<<<< + * device_args = "" + * py_byte_string = device_args.encode('UTF-8') + */ + } + + /* "urh/dev/native/lib/usrp.pyx":34 + * if not device_args: + * device_args = "" * py_byte_string = device_args.encode('UTF-8') # <<<<<<<<<<<<<< * cdef char* dev_args = py_byte_string * */ if (unlikely(__pyx_v_device_args == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 32, __pyx_L1_error) + __PYX_ERR(0, 34, __pyx_L1_error) } - __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_device_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_py_byte_string = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_device_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_py_byte_string = __pyx_t_3; + __pyx_t_3 = 0; - /* "urh/dev/native/lib/usrp.pyx":33 - * cpdef uhd_error open(str device_args): + /* "urh/dev/native/lib/usrp.pyx":35 + * device_args = "" * py_byte_string = device_args.encode('UTF-8') * cdef char* dev_args = py_byte_string # <<<<<<<<<<<<<< * * return uhd_usrp_make(&_c_device, dev_args) */ - __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L1_error) - __pyx_v_dev_args = __pyx_t_2; + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_v_dev_args = __pyx_t_4; - /* "urh/dev/native/lib/usrp.pyx":35 + /* "urh/dev/native/lib/usrp.pyx":37 * cdef char* dev_args = py_byte_string * * return uhd_usrp_make(&_c_device, dev_args) # <<<<<<<<<<<<<< @@ -2733,17 +2778,18 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_open(PyObject *__pyx_v_dev * CHANNEL = channel * * cpdef uhd_error open(str device_args): # <<<<<<<<<<<<<< - * py_byte_string = device_args.encode('UTF-8') - * cdef char* dev_args = py_byte_string + * if not device_args: + * device_args = "" */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("urh.dev.native.lib.usrp.open", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = (uhd_error) 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_byte_string); + __Pyx_XDECREF(__pyx_v_device_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -2789,7 +2835,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_4open(CYTHON_UNUSED PyObj return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":37 +/* "urh/dev/native/lib/usrp.pyx":39 * return uhd_usrp_make(&_c_device, dev_args) * * cpdef uhd_error close(): # <<<<<<<<<<<<<< @@ -2803,7 +2849,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_close(CYTHON_UNUSED int __ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); - /* "urh/dev/native/lib/usrp.pyx":38 + /* "urh/dev/native/lib/usrp.pyx":40 * * cpdef uhd_error close(): * return uhd_usrp_free(&_c_device) # <<<<<<<<<<<<<< @@ -2813,7 +2859,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_close(CYTHON_UNUSED int __ __pyx_r = uhd_usrp_free((&__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device)); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":37 + /* "urh/dev/native/lib/usrp.pyx":39 * return uhd_usrp_make(&_c_device, dev_args) * * cpdef uhd_error close(): # <<<<<<<<<<<<<< @@ -2846,7 +2892,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_6close(CYTHON_UNUSED PyOb PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("close", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_close(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_close(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2863,7 +2909,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_6close(CYTHON_UNUSED PyOb return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":40 +/* "urh/dev/native/lib/usrp.pyx":42 * return uhd_usrp_free(&_c_device) * * cpdef uhd_error setup_stream(): # <<<<<<<<<<<<<< @@ -2881,7 +2927,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED int __pyx_t_1; __Pyx_RefNannySetupContext("setup_stream", 0); - /* "urh/dev/native/lib/usrp.pyx":43 + /* "urh/dev/native/lib/usrp.pyx":45 * cdef uhd_stream_args_t stream_args * # https://files.ettus.com/manual/structuhd_1_1stream__args__t.html * stream_args.cpu_format = "fc32" # <<<<<<<<<<<<<< @@ -2890,7 +2936,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_stream_args.cpu_format = ((char *)"fc32"); - /* "urh/dev/native/lib/usrp.pyx":44 + /* "urh/dev/native/lib/usrp.pyx":46 * # https://files.ettus.com/manual/structuhd_1_1stream__args__t.html * stream_args.cpu_format = "fc32" * stream_args.otw_format = "sc16" # <<<<<<<<<<<<<< @@ -2899,7 +2945,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_stream_args.otw_format = ((char *)"sc16"); - /* "urh/dev/native/lib/usrp.pyx":45 + /* "urh/dev/native/lib/usrp.pyx":47 * stream_args.cpu_format = "fc32" * stream_args.otw_format = "sc16" * stream_args.args = "" # <<<<<<<<<<<<<< @@ -2908,7 +2954,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_stream_args.args = ((char *)""); - /* "urh/dev/native/lib/usrp.pyx":46 + /* "urh/dev/native/lib/usrp.pyx":48 * stream_args.otw_format = "sc16" * stream_args.args = "" * cdef size_t channel = 0 # <<<<<<<<<<<<<< @@ -2917,7 +2963,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_channel = 0; - /* "urh/dev/native/lib/usrp.pyx":47 + /* "urh/dev/native/lib/usrp.pyx":49 * stream_args.args = "" * cdef size_t channel = 0 * stream_args.channel_list = &channel # <<<<<<<<<<<<<< @@ -2926,7 +2972,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_stream_args.channel_list = (&__pyx_v_channel); - /* "urh/dev/native/lib/usrp.pyx":48 + /* "urh/dev/native/lib/usrp.pyx":50 * cdef size_t channel = 0 * stream_args.channel_list = &channel * stream_args.n_channels = 1 # <<<<<<<<<<<<<< @@ -2935,7 +2981,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_stream_args.n_channels = 1; - /* "urh/dev/native/lib/usrp.pyx":50 + /* "urh/dev/native/lib/usrp.pyx":52 * stream_args.n_channels = 1 * * cdef size_t num_channels = 0 # <<<<<<<<<<<<<< @@ -2944,7 +2990,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ __pyx_v_num_channels = 0; - /* "urh/dev/native/lib/usrp.pyx":52 + /* "urh/dev/native/lib/usrp.pyx":54 * cdef size_t num_channels = 0 * * if not IS_TX: # <<<<<<<<<<<<<< @@ -2954,7 +3000,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED __pyx_t_1 = ((!(__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0)) != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":53 + /* "urh/dev/native/lib/usrp.pyx":55 * * if not IS_TX: * uhd_rx_streamer_make(&rx_streamer_handle) # <<<<<<<<<<<<<< @@ -2963,7 +3009,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ (void)(uhd_rx_streamer_make((&__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle))); - /* "urh/dev/native/lib/usrp.pyx":54 + /* "urh/dev/native/lib/usrp.pyx":56 * if not IS_TX: * uhd_rx_streamer_make(&rx_streamer_handle) * uhd_usrp_get_rx_stream(_c_device, &stream_args, rx_streamer_handle) # <<<<<<<<<<<<<< @@ -2972,7 +3018,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ (void)(uhd_usrp_get_rx_stream(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, (&__pyx_v_stream_args), __pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle)); - /* "urh/dev/native/lib/usrp.pyx":55 + /* "urh/dev/native/lib/usrp.pyx":57 * uhd_rx_streamer_make(&rx_streamer_handle) * uhd_usrp_get_rx_stream(_c_device, &stream_args, rx_streamer_handle) * uhd_rx_streamer_num_channels(rx_streamer_handle, &num_channels) # <<<<<<<<<<<<<< @@ -2981,7 +3027,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ (void)(uhd_rx_streamer_num_channels(__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle, (&__pyx_v_num_channels))); - /* "urh/dev/native/lib/usrp.pyx":52 + /* "urh/dev/native/lib/usrp.pyx":54 * cdef size_t num_channels = 0 * * if not IS_TX: # <<<<<<<<<<<<<< @@ -2991,7 +3037,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED goto __pyx_L3; } - /* "urh/dev/native/lib/usrp.pyx":57 + /* "urh/dev/native/lib/usrp.pyx":59 * uhd_rx_streamer_num_channels(rx_streamer_handle, &num_channels) * else: * uhd_tx_streamer_make(&tx_streamer_handle) # <<<<<<<<<<<<<< @@ -3001,7 +3047,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED /*else*/ { (void)(uhd_tx_streamer_make((&__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_streamer_handle))); - /* "urh/dev/native/lib/usrp.pyx":58 + /* "urh/dev/native/lib/usrp.pyx":60 * else: * uhd_tx_streamer_make(&tx_streamer_handle) * uhd_usrp_get_tx_stream(_c_device, &stream_args, tx_streamer_handle) # <<<<<<<<<<<<<< @@ -3010,7 +3056,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED */ (void)(uhd_usrp_get_tx_stream(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, (&__pyx_v_stream_args), __pyx_v_3urh_3dev_6native_3lib_4usrp_tx_streamer_handle)); - /* "urh/dev/native/lib/usrp.pyx":59 + /* "urh/dev/native/lib/usrp.pyx":61 * uhd_tx_streamer_make(&tx_streamer_handle) * uhd_usrp_get_tx_stream(_c_device, &stream_args, tx_streamer_handle) * uhd_tx_streamer_num_channels(tx_streamer_handle, &num_channels) # <<<<<<<<<<<<<< @@ -3021,7 +3067,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(CYTHON_UNUSED } __pyx_L3:; - /* "urh/dev/native/lib/usrp.pyx":40 + /* "urh/dev/native/lib/usrp.pyx":42 * return uhd_usrp_free(&_c_device) * * cpdef uhd_error setup_stream(): # <<<<<<<<<<<<<< @@ -3054,7 +3100,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_8setup_stream(CYTHON_UNUS PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("setup_stream", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_setup_stream(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3071,7 +3117,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_8setup_stream(CYTHON_UNUS return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":61 +/* "urh/dev/native/lib/usrp.pyx":63 * uhd_tx_streamer_num_channels(tx_streamer_handle, &num_channels) * * cpdef uhd_error start_stream(int num_samples): # <<<<<<<<<<<<<< @@ -3087,7 +3133,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED int __pyx_t_1; __Pyx_RefNannySetupContext("start_stream", 0); - /* "urh/dev/native/lib/usrp.pyx":62 + /* "urh/dev/native/lib/usrp.pyx":64 * * cpdef uhd_error start_stream(int num_samples): * if IS_TX: # <<<<<<<<<<<<<< @@ -3097,7 +3143,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":63 + /* "urh/dev/native/lib/usrp.pyx":65 * cpdef uhd_error start_stream(int num_samples): * if IS_TX: * uhd_tx_streamer_max_num_samps(tx_streamer_handle, &max_num_tx_samples) # <<<<<<<<<<<<<< @@ -3106,7 +3152,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ (void)(uhd_tx_streamer_max_num_samps(__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_streamer_handle, (&__pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_tx_samples))); - /* "urh/dev/native/lib/usrp.pyx":64 + /* "urh/dev/native/lib/usrp.pyx":66 * if IS_TX: * uhd_tx_streamer_max_num_samps(tx_streamer_handle, &max_num_tx_samples) * return uhd_tx_metadata_make(&tx_metadata_handle, False, 0, 0.1, True, False) # <<<<<<<<<<<<<< @@ -3116,7 +3162,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED __pyx_r = uhd_tx_metadata_make((&__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_metadata_handle), 0, 0, 0.1, 1, 0); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":62 + /* "urh/dev/native/lib/usrp.pyx":64 * * cpdef uhd_error start_stream(int num_samples): * if IS_TX: # <<<<<<<<<<<<<< @@ -3125,7 +3171,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ } - /* "urh/dev/native/lib/usrp.pyx":67 + /* "urh/dev/native/lib/usrp.pyx":69 * * cdef uhd_stream_cmd_t stream_cmd * stream_cmd.stream_mode = uhd_stream_mode_t.UHD_STREAM_MODE_START_CONTINUOUS # <<<<<<<<<<<<<< @@ -3134,7 +3180,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ __pyx_v_stream_cmd.stream_mode = UHD_STREAM_MODE_START_CONTINUOUS; - /* "urh/dev/native/lib/usrp.pyx":68 + /* "urh/dev/native/lib/usrp.pyx":70 * cdef uhd_stream_cmd_t stream_cmd * stream_cmd.stream_mode = uhd_stream_mode_t.UHD_STREAM_MODE_START_CONTINUOUS * stream_cmd.num_samps = 0 # <<<<<<<<<<<<<< @@ -3143,7 +3189,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ __pyx_v_stream_cmd.num_samps = 0; - /* "urh/dev/native/lib/usrp.pyx":69 + /* "urh/dev/native/lib/usrp.pyx":71 * stream_cmd.stream_mode = uhd_stream_mode_t.UHD_STREAM_MODE_START_CONTINUOUS * stream_cmd.num_samps = 0 * stream_cmd.stream_now = True # <<<<<<<<<<<<<< @@ -3152,7 +3198,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ __pyx_v_stream_cmd.stream_now = 1; - /* "urh/dev/native/lib/usrp.pyx":71 + /* "urh/dev/native/lib/usrp.pyx":73 * stream_cmd.stream_now = True * * uhd_rx_streamer_max_num_samps(rx_streamer_handle, &max_num_rx_samples) # <<<<<<<<<<<<<< @@ -3161,7 +3207,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ (void)(uhd_rx_streamer_max_num_samps(__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle, (&__pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_rx_samples))); - /* "urh/dev/native/lib/usrp.pyx":73 + /* "urh/dev/native/lib/usrp.pyx":75 * uhd_rx_streamer_max_num_samps(rx_streamer_handle, &max_num_rx_samples) * * uhd_rx_metadata_make(&rx_metadata_handle) # <<<<<<<<<<<<<< @@ -3170,7 +3216,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED */ (void)(uhd_rx_metadata_make((&__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_metadata_handle))); - /* "urh/dev/native/lib/usrp.pyx":74 + /* "urh/dev/native/lib/usrp.pyx":76 * * uhd_rx_metadata_make(&rx_metadata_handle) * return uhd_rx_streamer_issue_stream_cmd(rx_streamer_handle, &stream_cmd) # <<<<<<<<<<<<<< @@ -3180,7 +3226,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(CYTHON_UNUSED __pyx_r = uhd_rx_streamer_issue_stream_cmd(__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle, (&__pyx_v_stream_cmd)); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":61 + /* "urh/dev/native/lib/usrp.pyx":63 * uhd_tx_streamer_num_channels(tx_streamer_handle, &num_channels) * * cpdef uhd_error start_stream(int num_samples): # <<<<<<<<<<<<<< @@ -3202,7 +3248,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_11start_stream(PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start_stream (wrapper)", 0); assert(__pyx_arg_num_samples); { - __pyx_v_num_samples = __Pyx_PyInt_As_int(__pyx_arg_num_samples); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) + __pyx_v_num_samples = __Pyx_PyInt_As_int(__pyx_arg_num_samples); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3223,7 +3269,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_10start_stream(CYTHON_UNU PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("start_stream", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(__pyx_v_num_samples, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_start_stream(__pyx_v_num_samples, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3240,7 +3286,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_10start_stream(CYTHON_UNU return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":76 +/* "urh/dev/native/lib/usrp.pyx":78 * return uhd_rx_streamer_issue_stream_cmd(rx_streamer_handle, &stream_cmd) * * cpdef uhd_error stop_stream(): # <<<<<<<<<<<<<< @@ -3256,7 +3302,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED int __pyx_t_1; __Pyx_RefNannySetupContext("stop_stream", 0); - /* "urh/dev/native/lib/usrp.pyx":77 + /* "urh/dev/native/lib/usrp.pyx":79 * * cpdef uhd_error stop_stream(): * if IS_TX: # <<<<<<<<<<<<<< @@ -3266,7 +3312,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":78 + /* "urh/dev/native/lib/usrp.pyx":80 * cpdef uhd_error stop_stream(): * if IS_TX: * return uhd_tx_metadata_free(&tx_metadata_handle) # <<<<<<<<<<<<<< @@ -3276,7 +3322,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED __pyx_r = uhd_tx_metadata_free((&__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_metadata_handle)); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":77 + /* "urh/dev/native/lib/usrp.pyx":79 * * cpdef uhd_error stop_stream(): * if IS_TX: # <<<<<<<<<<<<<< @@ -3285,7 +3331,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED */ } - /* "urh/dev/native/lib/usrp.pyx":81 + /* "urh/dev/native/lib/usrp.pyx":83 * * cdef uhd_stream_cmd_t stream_cmd * stream_cmd.stream_mode = uhd_stream_mode_t.UHD_STREAM_MODE_STOP_CONTINUOUS # <<<<<<<<<<<<<< @@ -3294,7 +3340,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED */ __pyx_v_stream_cmd.stream_mode = UHD_STREAM_MODE_STOP_CONTINUOUS; - /* "urh/dev/native/lib/usrp.pyx":82 + /* "urh/dev/native/lib/usrp.pyx":84 * cdef uhd_stream_cmd_t stream_cmd * stream_cmd.stream_mode = uhd_stream_mode_t.UHD_STREAM_MODE_STOP_CONTINUOUS * uhd_rx_metadata_free(&rx_metadata_handle) # <<<<<<<<<<<<<< @@ -3303,7 +3349,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED */ (void)(uhd_rx_metadata_free((&__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_metadata_handle))); - /* "urh/dev/native/lib/usrp.pyx":83 + /* "urh/dev/native/lib/usrp.pyx":85 * stream_cmd.stream_mode = uhd_stream_mode_t.UHD_STREAM_MODE_STOP_CONTINUOUS * uhd_rx_metadata_free(&rx_metadata_handle) * return uhd_rx_streamer_issue_stream_cmd(rx_streamer_handle, &stream_cmd) # <<<<<<<<<<<<<< @@ -3313,7 +3359,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(CYTHON_UNUSED __pyx_r = uhd_rx_streamer_issue_stream_cmd(__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle, (&__pyx_v_stream_cmd)); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":76 + /* "urh/dev/native/lib/usrp.pyx":78 * return uhd_rx_streamer_issue_stream_cmd(rx_streamer_handle, &stream_cmd) * * cpdef uhd_error stop_stream(): # <<<<<<<<<<<<<< @@ -3346,7 +3392,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_12stop_stream(CYTHON_UNUS PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("stop_stream", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_stop_stream(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3363,7 +3409,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_12stop_stream(CYTHON_UNUS return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":85 +/* "urh/dev/native/lib/usrp.pyx":87 * return uhd_rx_streamer_issue_stream_cmd(rx_streamer_handle, &stream_cmd) * * cpdef uhd_error destroy_stream(): # <<<<<<<<<<<<<< @@ -3378,7 +3424,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(CYTHON_UNUS int __pyx_t_1; __Pyx_RefNannySetupContext("destroy_stream", 0); - /* "urh/dev/native/lib/usrp.pyx":86 + /* "urh/dev/native/lib/usrp.pyx":88 * * cpdef uhd_error destroy_stream(): * if not IS_TX: # <<<<<<<<<<<<<< @@ -3388,7 +3434,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(CYTHON_UNUS __pyx_t_1 = ((!(__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0)) != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":87 + /* "urh/dev/native/lib/usrp.pyx":89 * cpdef uhd_error destroy_stream(): * if not IS_TX: * return uhd_rx_streamer_free(&rx_streamer_handle) # <<<<<<<<<<<<<< @@ -3398,7 +3444,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(CYTHON_UNUS __pyx_r = uhd_rx_streamer_free((&__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle)); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":86 + /* "urh/dev/native/lib/usrp.pyx":88 * * cpdef uhd_error destroy_stream(): * if not IS_TX: # <<<<<<<<<<<<<< @@ -3407,7 +3453,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(CYTHON_UNUS */ } - /* "urh/dev/native/lib/usrp.pyx":89 + /* "urh/dev/native/lib/usrp.pyx":91 * return uhd_rx_streamer_free(&rx_streamer_handle) * else: * return uhd_tx_streamer_free(&tx_streamer_handle) # <<<<<<<<<<<<<< @@ -3419,7 +3465,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(CYTHON_UNUS goto __pyx_L0; } - /* "urh/dev/native/lib/usrp.pyx":85 + /* "urh/dev/native/lib/usrp.pyx":87 * return uhd_rx_streamer_issue_stream_cmd(rx_streamer_handle, &stream_cmd) * * cpdef uhd_error destroy_stream(): # <<<<<<<<<<<<<< @@ -3452,7 +3498,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_14destroy_stream(CYTHON_U PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("destroy_stream", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_destroy_stream(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3469,7 +3515,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_14destroy_stream(CYTHON_U return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":91 +/* "urh/dev/native/lib/usrp.pyx":93 * return uhd_tx_streamer_free(&tx_streamer_handle) * * cpdef uhd_error recv_stream(connection, int num_samples): # <<<<<<<<<<<<<< @@ -3504,7 +3550,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py PyObject *__pyx_t_15 = NULL; __Pyx_RefNannySetupContext("recv_stream", 0); - /* "urh/dev/native/lib/usrp.pyx":92 + /* "urh/dev/native/lib/usrp.pyx":94 * * cpdef uhd_error recv_stream(connection, int num_samples): * num_samples = ((num_samples / max_num_rx_samples) + 1) * max_num_rx_samples # <<<<<<<<<<<<<< @@ -3513,7 +3559,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ __pyx_v_num_samples = ((((int)(((size_t)__pyx_v_num_samples) / __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_rx_samples)) + 1) * __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_rx_samples); - /* "urh/dev/native/lib/usrp.pyx":93 + /* "urh/dev/native/lib/usrp.pyx":95 * cpdef uhd_error recv_stream(connection, int num_samples): * num_samples = ((num_samples / max_num_rx_samples) + 1) * max_num_rx_samples * cdef float* result = malloc(num_samples * 2 * sizeof(float)) # <<<<<<<<<<<<<< @@ -3522,7 +3568,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ __pyx_v_result = ((float *)malloc(((__pyx_v_num_samples * 2) * (sizeof(float))))); - /* "urh/dev/native/lib/usrp.pyx":94 + /* "urh/dev/native/lib/usrp.pyx":96 * num_samples = ((num_samples / max_num_rx_samples) + 1) * max_num_rx_samples * cdef float* result = malloc(num_samples * 2 * sizeof(float)) * if not result: # <<<<<<<<<<<<<< @@ -3532,16 +3578,16 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __pyx_t_1 = ((!(__pyx_v_result != 0)) != 0); if (unlikely(__pyx_t_1)) { - /* "urh/dev/native/lib/usrp.pyx":95 + /* "urh/dev/native/lib/usrp.pyx":97 * cdef float* result = malloc(num_samples * 2 * sizeof(float)) * if not result: * raise MemoryError() # <<<<<<<<<<<<<< * * cdef int current_index = 0 */ - PyErr_NoMemory(); __PYX_ERR(0, 95, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 97, __pyx_L1_error) - /* "urh/dev/native/lib/usrp.pyx":94 + /* "urh/dev/native/lib/usrp.pyx":96 * num_samples = ((num_samples / max_num_rx_samples) + 1) * max_num_rx_samples * cdef float* result = malloc(num_samples * 2 * sizeof(float)) * if not result: # <<<<<<<<<<<<<< @@ -3550,7 +3596,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ } - /* "urh/dev/native/lib/usrp.pyx":97 + /* "urh/dev/native/lib/usrp.pyx":99 * raise MemoryError() * * cdef int current_index = 0 # <<<<<<<<<<<<<< @@ -3559,7 +3605,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ __pyx_v_current_index = 0; - /* "urh/dev/native/lib/usrp.pyx":98 + /* "urh/dev/native/lib/usrp.pyx":100 * * cdef int current_index = 0 * cdef int i = 0 # <<<<<<<<<<<<<< @@ -3568,7 +3614,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ __pyx_v_i = 0; - /* "urh/dev/native/lib/usrp.pyx":101 + /* "urh/dev/native/lib/usrp.pyx":103 * * * cdef float* buff = malloc(max_num_rx_samples * 2 * sizeof(float)) # <<<<<<<<<<<<<< @@ -3577,7 +3623,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ __pyx_v_buff = ((float *)malloc(((__pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_rx_samples * 2) * (sizeof(float))))); - /* "urh/dev/native/lib/usrp.pyx":102 + /* "urh/dev/native/lib/usrp.pyx":104 * * cdef float* buff = malloc(max_num_rx_samples * 2 * sizeof(float)) * if not buff: # <<<<<<<<<<<<<< @@ -3587,16 +3633,16 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __pyx_t_1 = ((!(__pyx_v_buff != 0)) != 0); if (unlikely(__pyx_t_1)) { - /* "urh/dev/native/lib/usrp.pyx":103 + /* "urh/dev/native/lib/usrp.pyx":105 * cdef float* buff = malloc(max_num_rx_samples * 2 * sizeof(float)) * if not buff: * raise MemoryError() # <<<<<<<<<<<<<< * * cdef void ** buffs = &buff */ - PyErr_NoMemory(); __PYX_ERR(0, 103, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 105, __pyx_L1_error) - /* "urh/dev/native/lib/usrp.pyx":102 + /* "urh/dev/native/lib/usrp.pyx":104 * * cdef float* buff = malloc(max_num_rx_samples * 2 * sizeof(float)) * if not buff: # <<<<<<<<<<<<<< @@ -3605,7 +3651,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ } - /* "urh/dev/native/lib/usrp.pyx":105 + /* "urh/dev/native/lib/usrp.pyx":107 * raise MemoryError() * * cdef void ** buffs = &buff # <<<<<<<<<<<<<< @@ -3614,7 +3660,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ __pyx_v_buffs = ((void **)(&__pyx_v_buff)); - /* "urh/dev/native/lib/usrp.pyx":109 + /* "urh/dev/native/lib/usrp.pyx":111 * * * try: # <<<<<<<<<<<<<< @@ -3623,7 +3669,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ /*try:*/ { - /* "urh/dev/native/lib/usrp.pyx":110 + /* "urh/dev/native/lib/usrp.pyx":112 * * try: * while current_index < 2*num_samples: # <<<<<<<<<<<<<< @@ -3634,7 +3680,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __pyx_t_1 = ((__pyx_v_current_index < (2 * __pyx_v_num_samples)) != 0); if (!__pyx_t_1) break; - /* "urh/dev/native/lib/usrp.pyx":111 + /* "urh/dev/native/lib/usrp.pyx":113 * try: * while current_index < 2*num_samples: * uhd_rx_streamer_recv(rx_streamer_handle, buffs, max_num_rx_samples, &rx_metadata_handle, 3.0, False, &items_received) # <<<<<<<<<<<<<< @@ -3643,7 +3689,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ (void)(uhd_rx_streamer_recv(__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_streamer_handle, __pyx_v_buffs, __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_rx_samples, (&__pyx_v_3urh_3dev_6native_3lib_4usrp_rx_metadata_handle), 3.0, 0, (&__pyx_v_items_received))); - /* "urh/dev/native/lib/usrp.pyx":112 + /* "urh/dev/native/lib/usrp.pyx":114 * while current_index < 2*num_samples: * uhd_rx_streamer_recv(rx_streamer_handle, buffs, max_num_rx_samples, &rx_metadata_handle, 3.0, False, &items_received) * memcpy(&result[current_index], &buff[0], 2 * items_received * sizeof(float)) # <<<<<<<<<<<<<< @@ -3652,7 +3698,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ (void)(memcpy((&(__pyx_v_result[__pyx_v_current_index])), (&(__pyx_v_buff[0])), ((2 * __pyx_v_items_received) * (sizeof(float))))); - /* "urh/dev/native/lib/usrp.pyx":116 + /* "urh/dev/native/lib/usrp.pyx":118 * # result[i] = buff[i-current_index] * * current_index += 2*items_received # <<<<<<<<<<<<<< @@ -3662,26 +3708,26 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __pyx_v_current_index = (__pyx_v_current_index + (2 * __pyx_v_items_received)); } - /* "urh/dev/native/lib/usrp.pyx":118 + /* "urh/dev/native/lib/usrp.pyx":120 * current_index += 2*items_received * * connection.send_bytes(result) # <<<<<<<<<<<<<< * finally: * free(buff) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_send_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_connection, __pyx_n_s_send_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); if (!__pyx_v_result) { PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer"); - __PYX_ERR(0, 118, __pyx_L6_error) + __PYX_ERR(0, 120, __pyx_L6_error) } __pyx_t_6 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_float); __pyx_t_5 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)(2 * __pyx_v_num_samples))); - if (unlikely(!__pyx_t_6 || !__pyx_t_5 || !PyBytes_AsString(__pyx_t_6))) __PYX_ERR(0, 118, __pyx_L6_error) + if (unlikely(!__pyx_t_6 || !__pyx_t_5 || !PyBytes_AsString(__pyx_t_6))) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __pyx_array_new(__pyx_t_5, sizeof(float), PyBytes_AS_STRING(__pyx_t_6), (char *) "c", (char *) __pyx_v_result); - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L6_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -3696,14 +3742,14 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py } } if (!__pyx_t_6) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L6_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_t_4)}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L6_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -3712,20 +3758,20 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_t_4)}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L6_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } else #endif { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L6_error) + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L6_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -3734,7 +3780,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "urh/dev/native/lib/usrp.pyx":120 + /* "urh/dev/native/lib/usrp.pyx":122 * connection.send_bytes(result) * finally: * free(buff) # <<<<<<<<<<<<<< @@ -3745,7 +3791,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py /*normal exit:*/{ free(__pyx_v_buff); - /* "urh/dev/native/lib/usrp.pyx":121 + /* "urh/dev/native/lib/usrp.pyx":123 * finally: * free(buff) * free(result) # <<<<<<<<<<<<<< @@ -3776,7 +3822,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; { - /* "urh/dev/native/lib/usrp.pyx":120 + /* "urh/dev/native/lib/usrp.pyx":122 * connection.send_bytes(result) * finally: * free(buff) # <<<<<<<<<<<<<< @@ -3785,7 +3831,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py */ free(__pyx_v_buff); - /* "urh/dev/native/lib/usrp.pyx":121 + /* "urh/dev/native/lib/usrp.pyx":123 * finally: * free(buff) * free(result) # <<<<<<<<<<<<<< @@ -3811,7 +3857,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(PyObject *__py __pyx_L7:; } - /* "urh/dev/native/lib/usrp.pyx":91 + /* "urh/dev/native/lib/usrp.pyx":93 * return uhd_tx_streamer_free(&tx_streamer_handle) * * cpdef uhd_error recv_stream(connection, int num_samples): # <<<<<<<<<<<<<< @@ -3866,11 +3912,11 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_17recv_stream(PyObject *_ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_samples)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("recv_stream", 1, 2, 2, 1); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("recv_stream", 1, 2, 2, 1); __PYX_ERR(0, 93, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "recv_stream") < 0)) __PYX_ERR(0, 91, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "recv_stream") < 0)) __PYX_ERR(0, 93, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3879,11 +3925,11 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_17recv_stream(PyObject *_ values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_connection = values[0]; - __pyx_v_num_samples = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_v_num_samples = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_num_samples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("recv_stream", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("recv_stream", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 93, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("urh.dev.native.lib.usrp.recv_stream", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3902,7 +3948,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_16recv_stream(CYTHON_UNUS PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("recv_stream", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(__pyx_v_connection, __pyx_v_num_samples, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_recv_stream(__pyx_v_connection, __pyx_v_num_samples, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3919,7 +3965,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_16recv_stream(CYTHON_UNUS return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":126 +/* "urh/dev/native/lib/usrp.pyx":128 * @cython.initializedcheck(False) * @cython.wraparound(False) * cpdef uhd_error send_stream(float[::1] samples): # <<<<<<<<<<<<<< @@ -3953,7 +3999,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __Pyx_RefNannySetupContext("send_stream", 0); __PYX_INC_MEMVIEW(&__pyx_v_samples, 1); - /* "urh/dev/native/lib/usrp.pyx":127 + /* "urh/dev/native/lib/usrp.pyx":129 * @cython.wraparound(False) * cpdef uhd_error send_stream(float[::1] samples): * if len(samples) == 1 and samples[0] == 0: # <<<<<<<<<<<<<< @@ -3973,47 +4019,47 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":129 + /* "urh/dev/native/lib/usrp.pyx":131 * if len(samples) == 1 and samples[0] == 0: * # Fill with zeros. Use some more zeros to prevent underflows * samples = np.zeros(8 * max_num_tx_samples, dtype=np.float32) # <<<<<<<<<<<<<< * * cdef unsigned long i, index = 0 */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_FromSize_t((8 * __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_tx_samples)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_FromSize_t((8 * __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_tx_samples)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_9, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_9, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_samples, 1); __pyx_v_samples = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; - /* "urh/dev/native/lib/usrp.pyx":127 + /* "urh/dev/native/lib/usrp.pyx":129 * @cython.wraparound(False) * cpdef uhd_error send_stream(float[::1] samples): * if len(samples) == 1 and samples[0] == 0: # <<<<<<<<<<<<<< @@ -4022,7 +4068,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ } - /* "urh/dev/native/lib/usrp.pyx":131 + /* "urh/dev/native/lib/usrp.pyx":133 * samples = np.zeros(8 * max_num_tx_samples, dtype=np.float32) * * cdef unsigned long i, index = 0 # <<<<<<<<<<<<<< @@ -4031,7 +4077,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ __pyx_v_index = 0; - /* "urh/dev/native/lib/usrp.pyx":132 + /* "urh/dev/native/lib/usrp.pyx":134 * * cdef unsigned long i, index = 0 * cdef size_t num_samps_sent = 0 # <<<<<<<<<<<<<< @@ -4040,7 +4086,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ __pyx_v_num_samps_sent = 0; - /* "urh/dev/native/lib/usrp.pyx":133 + /* "urh/dev/native/lib/usrp.pyx":135 * cdef unsigned long i, index = 0 * cdef size_t num_samps_sent = 0 * cdef size_t sample_count = len(samples) # <<<<<<<<<<<<<< @@ -4050,7 +4096,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_samples); __pyx_v_sample_count = __pyx_t_2; - /* "urh/dev/native/lib/usrp.pyx":135 + /* "urh/dev/native/lib/usrp.pyx":137 * cdef size_t sample_count = len(samples) * * cdef float* buff = malloc(max_num_tx_samples * 2 * sizeof(float)) # <<<<<<<<<<<<<< @@ -4059,7 +4105,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ __pyx_v_buff = ((float *)malloc(((__pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_tx_samples * 2) * (sizeof(float))))); - /* "urh/dev/native/lib/usrp.pyx":136 + /* "urh/dev/native/lib/usrp.pyx":138 * * cdef float* buff = malloc(max_num_tx_samples * 2 * sizeof(float)) * if not buff: # <<<<<<<<<<<<<< @@ -4069,16 +4115,16 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __pyx_t_1 = ((!(__pyx_v_buff != 0)) != 0); if (unlikely(__pyx_t_1)) { - /* "urh/dev/native/lib/usrp.pyx":137 + /* "urh/dev/native/lib/usrp.pyx":139 * cdef float* buff = malloc(max_num_tx_samples * 2 * sizeof(float)) * if not buff: * raise MemoryError() # <<<<<<<<<<<<<< * * cdef const void ** buffs = &buff */ - PyErr_NoMemory(); __PYX_ERR(0, 137, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 139, __pyx_L1_error) - /* "urh/dev/native/lib/usrp.pyx":136 + /* "urh/dev/native/lib/usrp.pyx":138 * * cdef float* buff = malloc(max_num_tx_samples * 2 * sizeof(float)) * if not buff: # <<<<<<<<<<<<<< @@ -4087,7 +4133,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ } - /* "urh/dev/native/lib/usrp.pyx":139 + /* "urh/dev/native/lib/usrp.pyx":141 * raise MemoryError() * * cdef const void ** buffs = &buff # <<<<<<<<<<<<<< @@ -4096,7 +4142,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ __pyx_v_buffs = ((void const **)(&__pyx_v_buff)); - /* "urh/dev/native/lib/usrp.pyx":141 + /* "urh/dev/native/lib/usrp.pyx":143 * cdef const void ** buffs = &buff * * try: # <<<<<<<<<<<<<< @@ -4105,7 +4151,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ /*try:*/ { - /* "urh/dev/native/lib/usrp.pyx":142 + /* "urh/dev/native/lib/usrp.pyx":144 * * try: * for i in range(0, sample_count): # <<<<<<<<<<<<<< @@ -4117,7 +4163,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; - /* "urh/dev/native/lib/usrp.pyx":143 + /* "urh/dev/native/lib/usrp.pyx":145 * try: * for i in range(0, sample_count): * buff[index] = samples[i] # <<<<<<<<<<<<<< @@ -4127,7 +4173,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __pyx_t_13 = __pyx_v_i; (__pyx_v_buff[__pyx_v_index]) = (*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_samples.data) + __pyx_t_13)) ))); - /* "urh/dev/native/lib/usrp.pyx":144 + /* "urh/dev/native/lib/usrp.pyx":146 * for i in range(0, sample_count): * buff[index] = samples[i] * index += 1 # <<<<<<<<<<<<<< @@ -4136,7 +4182,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ __pyx_v_index = (__pyx_v_index + 1); - /* "urh/dev/native/lib/usrp.pyx":145 + /* "urh/dev/native/lib/usrp.pyx":147 * buff[index] = samples[i] * index += 1 * if index >= 2*max_num_tx_samples: # <<<<<<<<<<<<<< @@ -4146,7 +4192,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __pyx_t_1 = ((__pyx_v_index >= (2 * __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_tx_samples)) != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":146 + /* "urh/dev/native/lib/usrp.pyx":148 * index += 1 * if index >= 2*max_num_tx_samples: * index = 0 # <<<<<<<<<<<<<< @@ -4155,7 +4201,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ __pyx_v_index = 0; - /* "urh/dev/native/lib/usrp.pyx":147 + /* "urh/dev/native/lib/usrp.pyx":149 * if index >= 2*max_num_tx_samples: * index = 0 * uhd_tx_streamer_send(tx_streamer_handle, buffs, max_num_tx_samples, # <<<<<<<<<<<<<< @@ -4164,7 +4210,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews */ (void)(uhd_tx_streamer_send(__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_streamer_handle, __pyx_v_buffs, __pyx_v_3urh_3dev_6native_3lib_4usrp_max_num_tx_samples, (&__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_metadata_handle), 0.1, (&__pyx_v_num_samps_sent))); - /* "urh/dev/native/lib/usrp.pyx":145 + /* "urh/dev/native/lib/usrp.pyx":147 * buff[index] = samples[i] * index += 1 * if index >= 2*max_num_tx_samples: # <<<<<<<<<<<<<< @@ -4174,7 +4220,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews } } - /* "urh/dev/native/lib/usrp.pyx":150 + /* "urh/dev/native/lib/usrp.pyx":152 * &tx_metadata_handle, 0.1, &num_samps_sent) * * uhd_tx_streamer_send(tx_streamer_handle, buffs, int(index / 2), &tx_metadata_handle, 0.1, &num_samps_sent) # <<<<<<<<<<<<<< @@ -4184,7 +4230,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews (void)(uhd_tx_streamer_send(__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_streamer_handle, __pyx_v_buffs, ((size_t)(__pyx_v_index / 2)), (&__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_metadata_handle), 0.1, (&__pyx_v_num_samps_sent))); } - /* "urh/dev/native/lib/usrp.pyx":152 + /* "urh/dev/native/lib/usrp.pyx":154 * uhd_tx_streamer_send(tx_streamer_handle, buffs, int(index / 2), &tx_metadata_handle, 0.1, &num_samps_sent) * finally: * free(buff) # <<<<<<<<<<<<<< @@ -4199,7 +4245,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__Pyx_memviews __pyx_L9:; } - /* "urh/dev/native/lib/usrp.pyx":126 + /* "urh/dev/native/lib/usrp.pyx":128 * @cython.initializedcheck(False) * @cython.wraparound(False) * cpdef uhd_error send_stream(float[::1] samples): # <<<<<<<<<<<<<< @@ -4233,7 +4279,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_19send_stream(PyObject *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("send_stream (wrapper)", 0); assert(__pyx_arg_samples); { - __pyx_v_samples = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_arg_samples, PyBUF_WRITABLE); if (unlikely(!__pyx_v_samples.memview)) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_samples = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_arg_samples, PyBUF_WRITABLE); if (unlikely(!__pyx_v_samples.memview)) __PYX_ERR(0, 128, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4254,7 +4300,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_18send_stream(CYTHON_UNUS PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("send_stream", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__pyx_v_samples, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_send_stream(__pyx_v_samples, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4272,7 +4318,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_18send_stream(CYTHON_UNUS return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":155 +/* "urh/dev/native/lib/usrp.pyx":157 * * * cpdef str get_device_representation(): # <<<<<<<<<<<<<< @@ -4289,7 +4335,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation( PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_device_representation", 0); - /* "urh/dev/native/lib/usrp.pyx":156 + /* "urh/dev/native/lib/usrp.pyx":158 * * cpdef str get_device_representation(): * cdef size_t size = 3000 # <<<<<<<<<<<<<< @@ -4298,7 +4344,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation( */ __pyx_v_size = 0xBB8; - /* "urh/dev/native/lib/usrp.pyx":157 + /* "urh/dev/native/lib/usrp.pyx":159 * cpdef str get_device_representation(): * cdef size_t size = 3000 * cdef char * result = malloc(size * sizeof(char)) # <<<<<<<<<<<<<< @@ -4307,7 +4353,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation( */ __pyx_v_result = ((char *)malloc((__pyx_v_size * (sizeof(char))))); - /* "urh/dev/native/lib/usrp.pyx":158 + /* "urh/dev/native/lib/usrp.pyx":160 * cdef size_t size = 3000 * cdef char * result = malloc(size * sizeof(char)) * uhd_usrp_get_pp_string(_c_device, result, size) # <<<<<<<<<<<<<< @@ -4316,7 +4362,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation( */ (void)(uhd_usrp_get_pp_string(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, __pyx_v_result, __pyx_v_size)); - /* "urh/dev/native/lib/usrp.pyx":159 + /* "urh/dev/native/lib/usrp.pyx":161 * cdef char * result = malloc(size * sizeof(char)) * uhd_usrp_get_pp_string(_c_device, result, size) * return result.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4324,13 +4370,13 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation( * cpdef uhd_error set_sample_rate(double sample_rate): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_result, 0, strlen(__pyx_v_result), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_result, 0, strlen(__pyx_v_result), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":155 + /* "urh/dev/native/lib/usrp.pyx":157 * * * cpdef str get_device_representation(): # <<<<<<<<<<<<<< @@ -4368,7 +4414,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_20get_device_representati PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_device_representation", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_4usrp_get_device_representation(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4385,7 +4431,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_20get_device_representati return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":161 +/* "urh/dev/native/lib/usrp.pyx":163 * return result.decode("UTF-8") * * cpdef uhd_error set_sample_rate(double sample_rate): # <<<<<<<<<<<<<< @@ -4400,7 +4446,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(double __p int __pyx_t_1; __Pyx_RefNannySetupContext("set_sample_rate", 0); - /* "urh/dev/native/lib/usrp.pyx":162 + /* "urh/dev/native/lib/usrp.pyx":164 * * cpdef uhd_error set_sample_rate(double sample_rate): * if IS_TX: # <<<<<<<<<<<<<< @@ -4410,7 +4456,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(double __p __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":163 + /* "urh/dev/native/lib/usrp.pyx":165 * cpdef uhd_error set_sample_rate(double sample_rate): * if IS_TX: * return uhd_usrp_set_tx_rate(_c_device, sample_rate, CHANNEL) # <<<<<<<<<<<<<< @@ -4420,7 +4466,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(double __p __pyx_r = uhd_usrp_set_tx_rate(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, __pyx_v_sample_rate, __pyx_v_3urh_3dev_6native_3lib_4usrp_CHANNEL); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":162 + /* "urh/dev/native/lib/usrp.pyx":164 * * cpdef uhd_error set_sample_rate(double sample_rate): * if IS_TX: # <<<<<<<<<<<<<< @@ -4429,7 +4475,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(double __p */ } - /* "urh/dev/native/lib/usrp.pyx":165 + /* "urh/dev/native/lib/usrp.pyx":167 * return uhd_usrp_set_tx_rate(_c_device, sample_rate, CHANNEL) * else: * return uhd_usrp_set_rx_rate(_c_device, sample_rate, CHANNEL) # <<<<<<<<<<<<<< @@ -4441,7 +4487,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(double __p goto __pyx_L0; } - /* "urh/dev/native/lib/usrp.pyx":161 + /* "urh/dev/native/lib/usrp.pyx":163 * return result.decode("UTF-8") * * cpdef uhd_error set_sample_rate(double sample_rate): # <<<<<<<<<<<<<< @@ -4463,7 +4509,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_23set_sample_rate(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_sample_rate (wrapper)", 0); assert(__pyx_arg_sample_rate); { - __pyx_v_sample_rate = __pyx_PyFloat_AsDouble(__pyx_arg_sample_rate); if (unlikely((__pyx_v_sample_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) + __pyx_v_sample_rate = __pyx_PyFloat_AsDouble(__pyx_arg_sample_rate); if (unlikely((__pyx_v_sample_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4484,7 +4530,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_22set_sample_rate(CYTHON_ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_sample_rate", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(__pyx_v_sample_rate, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_sample_rate(__pyx_v_sample_rate, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4501,7 +4547,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_22set_sample_rate(CYTHON_ return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":167 +/* "urh/dev/native/lib/usrp.pyx":169 * return uhd_usrp_set_rx_rate(_c_device, sample_rate, CHANNEL) * * cpdef uhd_error set_bandwidth(double bandwidth): # <<<<<<<<<<<<<< @@ -4516,7 +4562,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(double __pyx int __pyx_t_1; __Pyx_RefNannySetupContext("set_bandwidth", 0); - /* "urh/dev/native/lib/usrp.pyx":168 + /* "urh/dev/native/lib/usrp.pyx":170 * * cpdef uhd_error set_bandwidth(double bandwidth): * if IS_TX: # <<<<<<<<<<<<<< @@ -4526,7 +4572,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(double __pyx __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":169 + /* "urh/dev/native/lib/usrp.pyx":171 * cpdef uhd_error set_bandwidth(double bandwidth): * if IS_TX: * return uhd_usrp_set_tx_bandwidth(_c_device, bandwidth, CHANNEL) # <<<<<<<<<<<<<< @@ -4536,7 +4582,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(double __pyx __pyx_r = uhd_usrp_set_tx_bandwidth(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, __pyx_v_bandwidth, __pyx_v_3urh_3dev_6native_3lib_4usrp_CHANNEL); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":168 + /* "urh/dev/native/lib/usrp.pyx":170 * * cpdef uhd_error set_bandwidth(double bandwidth): * if IS_TX: # <<<<<<<<<<<<<< @@ -4545,7 +4591,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(double __pyx */ } - /* "urh/dev/native/lib/usrp.pyx":171 + /* "urh/dev/native/lib/usrp.pyx":173 * return uhd_usrp_set_tx_bandwidth(_c_device, bandwidth, CHANNEL) * else: * return uhd_usrp_set_rx_bandwidth(_c_device, bandwidth, CHANNEL) # <<<<<<<<<<<<<< @@ -4557,7 +4603,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(double __pyx goto __pyx_L0; } - /* "urh/dev/native/lib/usrp.pyx":167 + /* "urh/dev/native/lib/usrp.pyx":169 * return uhd_usrp_set_rx_rate(_c_device, sample_rate, CHANNEL) * * cpdef uhd_error set_bandwidth(double bandwidth): # <<<<<<<<<<<<<< @@ -4579,7 +4625,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_25set_bandwidth(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_bandwidth (wrapper)", 0); assert(__pyx_arg_bandwidth); { - __pyx_v_bandwidth = __pyx_PyFloat_AsDouble(__pyx_arg_bandwidth); if (unlikely((__pyx_v_bandwidth == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + __pyx_v_bandwidth = __pyx_PyFloat_AsDouble(__pyx_arg_bandwidth); if (unlikely((__pyx_v_bandwidth == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4600,7 +4646,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_24set_bandwidth(CYTHON_UN PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_bandwidth", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(__pyx_v_bandwidth, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_bandwidth(__pyx_v_bandwidth, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4617,7 +4663,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_24set_bandwidth(CYTHON_UN return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":173 +/* "urh/dev/native/lib/usrp.pyx":175 * return uhd_usrp_set_rx_bandwidth(_c_device, bandwidth, CHANNEL) * * cpdef uhd_error set_rf_gain(double normalized_gain): # <<<<<<<<<<<<<< @@ -4632,7 +4678,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(double __pyx_v int __pyx_t_1; __Pyx_RefNannySetupContext("set_rf_gain", 0); - /* "urh/dev/native/lib/usrp.pyx":179 + /* "urh/dev/native/lib/usrp.pyx":181 * :return: * """ * if IS_TX: # <<<<<<<<<<<<<< @@ -4642,7 +4688,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(double __pyx_v __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":180 + /* "urh/dev/native/lib/usrp.pyx":182 * """ * if IS_TX: * return uhd_usrp_set_normalized_tx_gain(_c_device, normalized_gain, CHANNEL) # <<<<<<<<<<<<<< @@ -4652,7 +4698,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(double __pyx_v __pyx_r = uhd_usrp_set_normalized_tx_gain(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, __pyx_v_normalized_gain, __pyx_v_3urh_3dev_6native_3lib_4usrp_CHANNEL); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":179 + /* "urh/dev/native/lib/usrp.pyx":181 * :return: * """ * if IS_TX: # <<<<<<<<<<<<<< @@ -4661,7 +4707,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(double __pyx_v */ } - /* "urh/dev/native/lib/usrp.pyx":182 + /* "urh/dev/native/lib/usrp.pyx":184 * return uhd_usrp_set_normalized_tx_gain(_c_device, normalized_gain, CHANNEL) * else: * return uhd_usrp_set_normalized_rx_gain(_c_device, normalized_gain, CHANNEL) # <<<<<<<<<<<<<< @@ -4673,7 +4719,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(double __pyx_v goto __pyx_L0; } - /* "urh/dev/native/lib/usrp.pyx":173 + /* "urh/dev/native/lib/usrp.pyx":175 * return uhd_usrp_set_rx_bandwidth(_c_device, bandwidth, CHANNEL) * * cpdef uhd_error set_rf_gain(double normalized_gain): # <<<<<<<<<<<<<< @@ -4696,7 +4742,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_27set_rf_gain(PyObject *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_rf_gain (wrapper)", 0); assert(__pyx_arg_normalized_gain); { - __pyx_v_normalized_gain = __pyx_PyFloat_AsDouble(__pyx_arg_normalized_gain); if (unlikely((__pyx_v_normalized_gain == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L3_error) + __pyx_v_normalized_gain = __pyx_PyFloat_AsDouble(__pyx_arg_normalized_gain); if (unlikely((__pyx_v_normalized_gain == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4717,7 +4763,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_26set_rf_gain(CYTHON_UNUS PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_rf_gain", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(__pyx_v_normalized_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_rf_gain(__pyx_v_normalized_gain, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4734,7 +4780,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_26set_rf_gain(CYTHON_UNUS return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":184 +/* "urh/dev/native/lib/usrp.pyx":186 * return uhd_usrp_set_normalized_rx_gain(_c_device, normalized_gain, CHANNEL) * * cpdef uhd_error set_center_freq(double center_freq): # <<<<<<<<<<<<<< @@ -4752,7 +4798,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p int __pyx_t_1; __Pyx_RefNannySetupContext("set_center_freq", 0); - /* "urh/dev/native/lib/usrp.pyx":186 + /* "urh/dev/native/lib/usrp.pyx":188 * cpdef uhd_error set_center_freq(double center_freq): * cdef uhd_tune_request_t tune_request * tune_request.target_freq = center_freq # <<<<<<<<<<<<<< @@ -4761,7 +4807,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p */ __pyx_v_tune_request.target_freq = __pyx_v_center_freq; - /* "urh/dev/native/lib/usrp.pyx":187 + /* "urh/dev/native/lib/usrp.pyx":189 * cdef uhd_tune_request_t tune_request * tune_request.target_freq = center_freq * tune_request.rf_freq_policy = uhd_tune_request_policy_t.UHD_TUNE_REQUEST_POLICY_AUTO # <<<<<<<<<<<<<< @@ -4770,7 +4816,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p */ __pyx_v_tune_request.rf_freq_policy = UHD_TUNE_REQUEST_POLICY_AUTO; - /* "urh/dev/native/lib/usrp.pyx":188 + /* "urh/dev/native/lib/usrp.pyx":190 * tune_request.target_freq = center_freq * tune_request.rf_freq_policy = uhd_tune_request_policy_t.UHD_TUNE_REQUEST_POLICY_AUTO * tune_request.dsp_freq_policy = uhd_tune_request_policy_t.UHD_TUNE_REQUEST_POLICY_AUTO # <<<<<<<<<<<<<< @@ -4779,7 +4825,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p */ __pyx_v_tune_request.dsp_freq_policy = UHD_TUNE_REQUEST_POLICY_AUTO; - /* "urh/dev/native/lib/usrp.pyx":191 + /* "urh/dev/native/lib/usrp.pyx":193 * * cdef uhd_tune_result_t tune_result * if IS_TX: # <<<<<<<<<<<<<< @@ -4789,7 +4835,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":192 + /* "urh/dev/native/lib/usrp.pyx":194 * cdef uhd_tune_result_t tune_result * if IS_TX: * result = uhd_usrp_set_tx_freq(_c_device, &tune_request, CHANNEL, &tune_result) # <<<<<<<<<<<<<< @@ -4798,7 +4844,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p */ __pyx_v_result = uhd_usrp_set_tx_freq(__pyx_v_3urh_3dev_6native_3lib_4usrp__c_device, (&__pyx_v_tune_request), __pyx_v_3urh_3dev_6native_3lib_4usrp_CHANNEL, (&__pyx_v_tune_result)); - /* "urh/dev/native/lib/usrp.pyx":191 + /* "urh/dev/native/lib/usrp.pyx":193 * * cdef uhd_tune_result_t tune_result * if IS_TX: # <<<<<<<<<<<<<< @@ -4808,7 +4854,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p goto __pyx_L3; } - /* "urh/dev/native/lib/usrp.pyx":194 + /* "urh/dev/native/lib/usrp.pyx":196 * result = uhd_usrp_set_tx_freq(_c_device, &tune_request, CHANNEL, &tune_result) * else: * result = uhd_usrp_set_rx_freq(_c_device, &tune_request, CHANNEL, &tune_result) # <<<<<<<<<<<<<< @@ -4820,7 +4866,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p } __pyx_L3:; - /* "urh/dev/native/lib/usrp.pyx":196 + /* "urh/dev/native/lib/usrp.pyx":198 * result = uhd_usrp_set_rx_freq(_c_device, &tune_request, CHANNEL, &tune_result) * * return result # <<<<<<<<<<<<<< @@ -4830,7 +4876,7 @@ static uhd_error __pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(double __p __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":184 + /* "urh/dev/native/lib/usrp.pyx":186 * return uhd_usrp_set_normalized_rx_gain(_c_device, normalized_gain, CHANNEL) * * cpdef uhd_error set_center_freq(double center_freq): # <<<<<<<<<<<<<< @@ -4852,7 +4898,7 @@ static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_29set_center_freq(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_center_freq (wrapper)", 0); assert(__pyx_arg_center_freq); { - __pyx_v_center_freq = __pyx_PyFloat_AsDouble(__pyx_arg_center_freq); if (unlikely((__pyx_v_center_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L3_error) + __pyx_v_center_freq = __pyx_PyFloat_AsDouble(__pyx_arg_center_freq); if (unlikely((__pyx_v_center_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4873,7 +4919,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_28set_center_freq(CYTHON_ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_center_freq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(__pyx_v_center_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_uhd_error(__pyx_f_3urh_3dev_6native_3lib_4usrp_set_center_freq(__pyx_v_center_freq, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4890,7 +4936,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_28set_center_freq(CYTHON_ return __pyx_r; } -/* "urh/dev/native/lib/usrp.pyx":198 +/* "urh/dev/native/lib/usrp.pyx":200 * return result * * cpdef str get_last_error(): # <<<<<<<<<<<<<< @@ -4908,7 +4954,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(CYTHON_UNUS PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("get_last_error", 0); - /* "urh/dev/native/lib/usrp.pyx":199 + /* "urh/dev/native/lib/usrp.pyx":201 * * cpdef str get_last_error(): * cdef char * error_msg = malloc(200 * sizeof(char)) # <<<<<<<<<<<<<< @@ -4917,7 +4963,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(CYTHON_UNUS */ __pyx_v_error_msg = ((char *)malloc((0xC8 * (sizeof(char))))); - /* "urh/dev/native/lib/usrp.pyx":201 + /* "urh/dev/native/lib/usrp.pyx":203 * cdef char * error_msg = malloc(200 * sizeof(char)) * * if IS_TX: # <<<<<<<<<<<<<< @@ -4927,7 +4973,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(CYTHON_UNUS __pyx_t_1 = (__pyx_v_3urh_3dev_6native_3lib_4usrp_IS_TX != 0); if (__pyx_t_1) { - /* "urh/dev/native/lib/usrp.pyx":202 + /* "urh/dev/native/lib/usrp.pyx":204 * * if IS_TX: * uhd_tx_streamer_last_error(tx_streamer_handle, error_msg, 200) # <<<<<<<<<<<<<< @@ -4936,7 +4982,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(CYTHON_UNUS */ (void)(uhd_tx_streamer_last_error(__pyx_v_3urh_3dev_6native_3lib_4usrp_tx_streamer_handle, __pyx_v_error_msg, 0xC8)); - /* "urh/dev/native/lib/usrp.pyx":201 + /* "urh/dev/native/lib/usrp.pyx":203 * cdef char * error_msg = malloc(200 * sizeof(char)) * * if IS_TX: # <<<<<<<<<<<<<< @@ -4946,7 +4992,7 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(CYTHON_UNUS goto __pyx_L3; } - /* "urh/dev/native/lib/usrp.pyx":204 + /* "urh/dev/native/lib/usrp.pyx":206 * uhd_tx_streamer_last_error(tx_streamer_handle, error_msg, 200) * else: * uhd_rx_streamer_last_error(rx_streamer_handle, error_msg, 200) # <<<<<<<<<<<<<< @@ -4958,29 +5004,32 @@ static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(CYTHON_UNUS } __pyx_L3:; - /* "urh/dev/native/lib/usrp.pyx":205 + /* "urh/dev/native/lib/usrp.pyx":207 * else: * uhd_rx_streamer_last_error(rx_streamer_handle, error_msg, 200) * error_msg_py = error_msg.decode("UTF-8") # <<<<<<<<<<<<<< * return error_msg_py + * */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_error_msg, 0, strlen(__pyx_v_error_msg), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_error_msg, 0, strlen(__pyx_v_error_msg), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_error_msg_py = __pyx_t_2; __pyx_t_2 = 0; - /* "urh/dev/native/lib/usrp.pyx":206 + /* "urh/dev/native/lib/usrp.pyx":208 * uhd_rx_streamer_last_error(rx_streamer_handle, error_msg, 200) * error_msg_py = error_msg.decode("UTF-8") * return error_msg_py # <<<<<<<<<<<<<< + * + * cpdef list find_devices(str args): */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyUnicode_CheckExact(__pyx_v_error_msg_py))||((__pyx_v_error_msg_py) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_error_msg_py)->tp_name), 0))) __PYX_ERR(0, 206, __pyx_L1_error) + if (!(likely(PyUnicode_CheckExact(__pyx_v_error_msg_py))||((__pyx_v_error_msg_py) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_error_msg_py)->tp_name), 0))) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_INCREF(__pyx_v_error_msg_py); __pyx_r = ((PyObject*)__pyx_v_error_msg_py); goto __pyx_L0; - /* "urh/dev/native/lib/usrp.pyx":198 + /* "urh/dev/native/lib/usrp.pyx":200 * return result * * cpdef str get_last_error(): # <<<<<<<<<<<<<< @@ -5019,7 +5068,7 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_30get_last_error(CYTHON_U PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_last_error", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_4usrp_get_last_error(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5036,6 +5085,289 @@ static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_30get_last_error(CYTHON_U return __pyx_r; } +/* "urh/dev/native/lib/usrp.pyx":210 + * return error_msg_py + * + * cpdef list find_devices(str args): # <<<<<<<<<<<<<< + * py_byte_string = args.encode('UTF-8') + * cdef char* dev_args = py_byte_string + */ + +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_33find_devices(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ +static PyObject *__pyx_f_3urh_3dev_6native_3lib_4usrp_find_devices(PyObject *__pyx_v_args, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_py_byte_string = NULL; + char *__pyx_v_dev_args; + uhd_string_vector_handle __pyx_v_h; + size_t __pyx_v_i; + size_t __pyx_v_num_devices; + char *__pyx_v_vector_str_item; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_device_str = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + size_t __pyx_t_5; + size_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + __Pyx_RefNannySetupContext("find_devices", 0); + + /* "urh/dev/native/lib/usrp.pyx":211 + * + * cpdef list find_devices(str args): + * py_byte_string = args.encode('UTF-8') # <<<<<<<<<<<<<< + * cdef char* dev_args = py_byte_string + * cdef uhd_string_vector_handle h + */ + if (unlikely(__pyx_v_args == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 211, __pyx_L1_error) + } + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_py_byte_string = __pyx_t_1; + __pyx_t_1 = 0; + + /* "urh/dev/native/lib/usrp.pyx":212 + * cpdef list find_devices(str args): + * py_byte_string = args.encode('UTF-8') + * cdef char* dev_args = py_byte_string # <<<<<<<<<<<<<< + * cdef uhd_string_vector_handle h + * uhd_string_vector_make(&h) + */ + __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_v_dev_args = __pyx_t_2; + + /* "urh/dev/native/lib/usrp.pyx":214 + * cdef char* dev_args = py_byte_string + * cdef uhd_string_vector_handle h + * uhd_string_vector_make(&h) # <<<<<<<<<<<<<< + * uhd_usrp_find(dev_args, &h) + * cdef size_t i, num_devices = 0 + */ + (void)(uhd_string_vector_make((&__pyx_v_h))); + + /* "urh/dev/native/lib/usrp.pyx":215 + * cdef uhd_string_vector_handle h + * uhd_string_vector_make(&h) + * uhd_usrp_find(dev_args, &h) # <<<<<<<<<<<<<< + * cdef size_t i, num_devices = 0 + * uhd_string_vector_size(h, &num_devices) + */ + (void)(uhd_usrp_find(__pyx_v_dev_args, (&__pyx_v_h))); + + /* "urh/dev/native/lib/usrp.pyx":216 + * uhd_string_vector_make(&h) + * uhd_usrp_find(dev_args, &h) + * cdef size_t i, num_devices = 0 # <<<<<<<<<<<<<< + * uhd_string_vector_size(h, &num_devices) + * cdef char* vector_str_item = malloc(512 * sizeof(char)) + */ + __pyx_v_num_devices = 0; + + /* "urh/dev/native/lib/usrp.pyx":217 + * uhd_usrp_find(dev_args, &h) + * cdef size_t i, num_devices = 0 + * uhd_string_vector_size(h, &num_devices) # <<<<<<<<<<<<<< + * cdef char* vector_str_item = malloc(512 * sizeof(char)) + * + */ + (void)(uhd_string_vector_size(__pyx_v_h, (&__pyx_v_num_devices))); + + /* "urh/dev/native/lib/usrp.pyx":218 + * cdef size_t i, num_devices = 0 + * uhd_string_vector_size(h, &num_devices) + * cdef char* vector_str_item = malloc(512 * sizeof(char)) # <<<<<<<<<<<<<< + * + * result = [] + */ + __pyx_v_vector_str_item = ((char *)malloc((0x200 * (sizeof(char))))); + + /* "urh/dev/native/lib/usrp.pyx":220 + * cdef char* vector_str_item = malloc(512 * sizeof(char)) + * + * result = [] # <<<<<<<<<<<<<< + * + * print(num_devices) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "urh/dev/native/lib/usrp.pyx":222 + * result = [] + * + * print(num_devices) # <<<<<<<<<<<<<< + * for i in range(num_devices): + * uhd_string_vector_at(h, i, vector_str_item, 512) + */ + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_num_devices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "urh/dev/native/lib/usrp.pyx":223 + * + * print(num_devices) + * for i in range(num_devices): # <<<<<<<<<<<<<< + * uhd_string_vector_at(h, i, vector_str_item, 512) + * device_str = vector_str_item.decode("UTF-8") + */ + __pyx_t_4 = __pyx_v_num_devices; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "urh/dev/native/lib/usrp.pyx":224 + * print(num_devices) + * for i in range(num_devices): + * uhd_string_vector_at(h, i, vector_str_item, 512) # <<<<<<<<<<<<<< + * device_str = vector_str_item.decode("UTF-8") + * if device_str not in result: + */ + (void)(uhd_string_vector_at(__pyx_v_h, __pyx_v_i, __pyx_v_vector_str_item, 0x200)); + + /* "urh/dev/native/lib/usrp.pyx":225 + * for i in range(num_devices): + * uhd_string_vector_at(h, i, vector_str_item, 512) + * device_str = vector_str_item.decode("UTF-8") # <<<<<<<<<<<<<< + * if device_str not in result: + * result.append(device_str) + */ + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_vector_str_item, 0, strlen(__pyx_v_vector_str_item), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_device_str, __pyx_t_3); + __pyx_t_3 = 0; + + /* "urh/dev/native/lib/usrp.pyx":226 + * uhd_string_vector_at(h, i, vector_str_item, 512) + * device_str = vector_str_item.decode("UTF-8") + * if device_str not in result: # <<<<<<<<<<<<<< + * result.append(device_str) + * + */ + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_device_str, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_8 = (__pyx_t_7 != 0); + if (__pyx_t_8) { + + /* "urh/dev/native/lib/usrp.pyx":227 + * device_str = vector_str_item.decode("UTF-8") + * if device_str not in result: + * result.append(device_str) # <<<<<<<<<<<<<< + * + * free(vector_str_item) + */ + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_device_str); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 227, __pyx_L1_error) + + /* "urh/dev/native/lib/usrp.pyx":226 + * uhd_string_vector_at(h, i, vector_str_item, 512) + * device_str = vector_str_item.decode("UTF-8") + * if device_str not in result: # <<<<<<<<<<<<<< + * result.append(device_str) + * + */ + } + } + + /* "urh/dev/native/lib/usrp.pyx":229 + * result.append(device_str) + * + * free(vector_str_item) # <<<<<<<<<<<<<< + * uhd_string_vector_free(&h) + * + */ + free(__pyx_v_vector_str_item); + + /* "urh/dev/native/lib/usrp.pyx":230 + * + * free(vector_str_item) + * uhd_string_vector_free(&h) # <<<<<<<<<<<<<< + * + * return result + */ + (void)(uhd_string_vector_free((&__pyx_v_h))); + + /* "urh/dev/native/lib/usrp.pyx":232 + * uhd_string_vector_free(&h) + * + * return result # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "urh/dev/native/lib/usrp.pyx":210 + * return error_msg_py + * + * cpdef list find_devices(str args): # <<<<<<<<<<<<<< + * py_byte_string = args.encode('UTF-8') + * cdef char* dev_args = py_byte_string + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("urh.dev.native.lib.usrp.find_devices", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_py_byte_string); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_device_str); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_33find_devices(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ +static PyObject *__pyx_pw_3urh_3dev_6native_3lib_4usrp_33find_devices(PyObject *__pyx_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find_devices (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyUnicode_Type), 1, "args", 1))) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_r = __pyx_pf_3urh_3dev_6native_3lib_4usrp_32find_devices(__pyx_self, ((PyObject*)__pyx_v_args)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_3urh_3dev_6native_3lib_4usrp_32find_devices(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("find_devices", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_3urh_3dev_6native_3lib_4usrp_find_devices(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("urh.dev.native.lib.usrp.find_devices", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":215 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. @@ -5152,7 +5484,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5208,7 +5540,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5465,7 +5797,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6345,7 +6677,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6413,7 +6745,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6522,7 +6854,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -7196,7 +7528,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -7325,7 +7657,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -7451,7 +7783,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -7695,7 +8027,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * * if itemsize <= 0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 132, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7727,7 +8059,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * * if not isinstance(format, bytes): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7762,7 +8094,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 138, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_5); @@ -7842,7 +8174,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 147, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -8116,7 +8448,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * * if self.dtype_is_object: */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 175, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; @@ -8357,7 +8689,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru * info.buf = self.data * info.len = self.len */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 191, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9073,7 +9405,7 @@ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __p * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9126,7 +9458,7 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10770,7 +11102,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit * * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 413, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -11797,7 +12129,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * else: * if len(self.view.format) == 1: */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 490, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 490, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -12153,7 +12485,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu * * if flags & PyBUF_STRIDES: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 515, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12693,7 +13025,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 565, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -12807,7 +13139,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__22, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__23, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -13808,7 +14140,7 @@ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struc * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13861,7 +14193,7 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -14212,9 +14544,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_GOTREF(__pyx_t_7); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__25); - __Pyx_GIVEREF(__pyx_slice__25); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__25); + __Pyx_INCREF(__pyx_slice__26); + __Pyx_GIVEREF(__pyx_slice__26); + PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__26); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 677, __pyx_L1_error) @@ -14247,7 +14579,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__26); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 680, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__27); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 680, __pyx_L1_error) } __pyx_L7:; @@ -14387,9 +14719,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_GOTREF(__pyx_t_3); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__27); + __Pyx_INCREF(__pyx_slice__28); + __Pyx_GIVEREF(__pyx_slice__28); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__28); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 691, __pyx_L1_error) @@ -14513,7 +14845,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 698, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -16676,7 +17008,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -16729,7 +17061,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -20497,8 +20829,8 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { * else: * alignment = b'' */ - __Pyx_INCREF(__pyx_kp_b__31); - __pyx_v_alignment = __pyx_kp_b__31; + __Pyx_INCREF(__pyx_kp_b__32); + __pyx_v_alignment = __pyx_kp_b__32; /* "BufferFormatFromTypeInfo":1467 * assert type.fields != NULL and type.fields.type != NULL @@ -20518,8 +20850,8 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { * parts = [b"T{"] */ /*else*/ { - __Pyx_INCREF(__pyx_kp_b__32); - __pyx_v_alignment = __pyx_kp_b__32; + __Pyx_INCREF(__pyx_kp_b_); + __pyx_v_alignment = __pyx_kp_b_; } __pyx_L6:; @@ -21448,6 +21780,7 @@ static PyMethodDef __pyx_methods[] = { {"set_rf_gain", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_4usrp_27set_rf_gain, METH_O, __pyx_doc_3urh_3dev_6native_3lib_4usrp_26set_rf_gain}, {"set_center_freq", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_4usrp_29set_center_freq, METH_O, 0}, {"get_last_error", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_4usrp_31get_last_error, METH_NOARGS, 0}, + {"find_devices", (PyCFunction)__pyx_pw_3urh_3dev_6native_3lib_4usrp_33find_devices, METH_O, 0}, {0, 0, 0, 0} }; @@ -21484,6 +21817,8 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0}, + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, @@ -21513,7 +21848,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_kp_b__31, __pyx_k__31, sizeof(__pyx_k__31), 0, 0, 0, 0}, {&__pyx_kp_b__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 0, 0, 0}, {&__pyx_kp_b__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 0, 0}, {&__pyx_kp_b__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 0, 0}, @@ -21563,6 +21897,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, @@ -21599,8 +21934,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 95, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 222, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 229, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1000, __pyx_L1_error) @@ -21625,9 +21961,9 @@ static int __Pyx_InitCachedConstants(void) { * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":233 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) @@ -21636,9 +21972,9 @@ static int __Pyx_InitCachedConstants(void) { * * info.buf = PyArray_DATA(self) */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":263 * if ((descr.byteorder == c'>' and little_endian) or @@ -21647,9 +21983,9 @@ static int __Pyx_InitCachedConstants(void) { * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":810 * @@ -21658,9 +21994,9 @@ static int __Pyx_InitCachedConstants(void) { * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":814 * if ((child.byteorder == c'>' and little_endian) or @@ -21669,9 +22005,9 @@ static int __Pyx_InitCachedConstants(void) { * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 814, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834 * t = child.type_num @@ -21680,9 +22016,9 @@ static int __Pyx_InitCachedConstants(void) { * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1000 * _import_array() @@ -21691,9 +22027,9 @@ static int __Pyx_InitCachedConstants(void) { * * cdef inline int import_umath() except -1: */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1000, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1006 * _import_umath() @@ -21702,18 +22038,18 @@ static int __Pyx_InitCachedConstants(void) { * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); /* "../../../../usr/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1012 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1012, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1012, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); /* "View.MemoryView":132 * @@ -21722,9 +22058,9 @@ static int __Pyx_InitCachedConstants(void) { * * if itemsize <= 0: */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); /* "View.MemoryView":135 * @@ -21733,9 +22069,9 @@ static int __Pyx_InitCachedConstants(void) { * * if not isinstance(format, bytes): */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "View.MemoryView":138 * @@ -21744,9 +22080,9 @@ static int __Pyx_InitCachedConstants(void) { * self._format = format # keep a reference to the byte string * self.format = self._format */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); /* "View.MemoryView":147 * @@ -21755,9 +22091,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); /* "View.MemoryView":175 * self.data = malloc(self.len) @@ -21766,9 +22102,9 @@ static int __Pyx_InitCachedConstants(void) { * * if self.dtype_is_object: */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 175, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); /* "View.MemoryView":191 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS @@ -21777,9 +22113,9 @@ static int __Pyx_InitCachedConstants(void) { * info.buf = self.data * info.len = self.len */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21787,18 +22123,18 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); /* "View.MemoryView":413 * def __setitem__(memoryview self, object index, object value): @@ -21807,9 +22143,9 @@ static int __Pyx_InitCachedConstants(void) { * * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); /* "View.MemoryView":490 * result = struct.unpack(self.view.format, bytesitem) @@ -21818,9 +22154,9 @@ static int __Pyx_InitCachedConstants(void) { * else: * if len(self.view.format) == 1: */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); /* "View.MemoryView":515 * def __getbuffer__(self, Py_buffer *info, int flags): @@ -21829,9 +22165,9 @@ static int __Pyx_InitCachedConstants(void) { * * if flags & PyBUF_STRIDES: */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); /* "View.MemoryView":565 * if self.view.strides == NULL: @@ -21840,9 +22176,9 @@ static int __Pyx_InitCachedConstants(void) { * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); /* "View.MemoryView":572 * def suboffsets(self): @@ -21851,12 +22187,12 @@ static int __Pyx_InitCachedConstants(void) { * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__22 = PyTuple_New(1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); + __pyx_tuple__23 = PyTuple_New(1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__22, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__22); + PyTuple_SET_ITEM(__pyx_tuple__23, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_tuple__23); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21864,18 +22200,18 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); /* "View.MemoryView":677 * if item is Ellipsis: @@ -21884,9 +22220,9 @@ static int __Pyx_InitCachedConstants(void) { * seen_ellipsis = True * else: */ - __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(2, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__25); - __Pyx_GIVEREF(__pyx_slice__25); + __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__26); + __Pyx_GIVEREF(__pyx_slice__26); /* "View.MemoryView":680 * seen_ellipsis = True @@ -21895,9 +22231,9 @@ static int __Pyx_InitCachedConstants(void) { * have_slices = True * else: */ - __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__26); - __Pyx_GIVEREF(__pyx_slice__26); + __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(2, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__27); + __Pyx_GIVEREF(__pyx_slice__27); /* "View.MemoryView":691 * nslices = ndim - len(result) @@ -21906,9 +22242,9 @@ static int __Pyx_InitCachedConstants(void) { * * return have_slices or nslices, tuple(result) */ - __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); + __pyx_slice__28 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__28)) __PYX_ERR(2, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__28); + __Pyx_GIVEREF(__pyx_slice__28); /* "View.MemoryView":698 * for suboffset in suboffsets[:ndim]: @@ -21917,9 +22253,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -21927,18 +22263,18 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); /* "View.MemoryView":285 * return self.name @@ -22118,7 +22454,7 @@ static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", - #if CYTHON_COMPILING_IN_PYPY + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), @@ -22222,7 +22558,7 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d } -static int __pyx_pymod_exec_usrp(PyObject *__pyx_pyinit_module) CYTHON_SMALL_CODE +static int __pyx_pymod_exec_usrp(PyObject *__pyx_pyinit_module) #endif #endif { diff --git a/src/urh/dev/native/lib/usrp.pyx b/src/urh/dev/native/lib/usrp.pyx index ae6ae713fb..b32d95bbc0 100644 --- a/src/urh/dev/native/lib/usrp.pyx +++ b/src/urh/dev/native/lib/usrp.pyx @@ -29,6 +29,8 @@ cpdef set_channel(size_t channel): CHANNEL = channel cpdef uhd_error open(str device_args): + if not device_args: + device_args = "" py_byte_string = device_args.encode('UTF-8') cdef char* dev_args = py_byte_string @@ -204,3 +206,27 @@ cpdef str get_last_error(): uhd_rx_streamer_last_error(rx_streamer_handle, error_msg, 200) error_msg_py = error_msg.decode("UTF-8") return error_msg_py + +cpdef list find_devices(str args): + py_byte_string = args.encode('UTF-8') + cdef char* dev_args = py_byte_string + cdef uhd_string_vector_handle h + uhd_string_vector_make(&h) + uhd_usrp_find(dev_args, &h) + cdef size_t i, num_devices = 0 + uhd_string_vector_size(h, &num_devices) + cdef char* vector_str_item = malloc(512 * sizeof(char)) + + result = [] + + print(num_devices) + for i in range(num_devices): + uhd_string_vector_at(h, i, vector_str_item, 512) + device_str = vector_str_item.decode("UTF-8") + if device_str not in result: + result.append(device_str) + + free(vector_str_item) + uhd_string_vector_free(&h) + + return result \ No newline at end of file diff --git a/src/urh/ui/ui_send_recv_device_settings.py b/src/urh/ui/ui_send_recv_device_settings.py index c820395a17..bf6ee74e4c 100644 --- a/src/urh/ui/ui_send_recv_device_settings.py +++ b/src/urh/ui/ui_send_recv_device_settings.py @@ -62,14 +62,6 @@ def setupUi(self, FormDeviceSettings): self.cbDevice.addItem("") self.cbDevice.addItem("") self.gridLayout.addWidget(self.cbDevice, 0, 1, 1, 1) - self.labelDeviceArgs = QtWidgets.QLabel(self.frame_2) - self.labelDeviceArgs.setToolTipDuration(-1) - self.labelDeviceArgs.setStyleSheet("") - self.labelDeviceArgs.setObjectName("labelDeviceArgs") - self.gridLayout.addWidget(self.labelDeviceArgs, 1, 0, 1, 1) - self.lineEditDeviceArgs = QtWidgets.QLineEdit(self.frame_2) - self.lineEditDeviceArgs.setObjectName("lineEditDeviceArgs") - self.gridLayout.addWidget(self.lineEditDeviceArgs, 1, 1, 1, 1) self.labelChannel = QtWidgets.QLabel(self.frame_2) self.labelChannel.setObjectName("labelChannel") self.gridLayout.addWidget(self.labelChannel, 2, 0, 1, 1) @@ -115,6 +107,9 @@ def setupUi(self, FormDeviceSettings): self.spinBoxSampleRate.setMaximum(1000000000000.0) self.spinBoxSampleRate.setObjectName("spinBoxSampleRate") self.gridLayout.addWidget(self.spinBoxSampleRate, 7, 1, 1, 1) + self.labelBandwidth = QtWidgets.QLabel(self.frame_2) + self.labelBandwidth.setObjectName("labelBandwidth") + self.gridLayout.addWidget(self.labelBandwidth, 8, 0, 1, 1) self.btnLockBWSR = QtWidgets.QToolButton(self.frame_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -129,18 +124,15 @@ def setupUi(self, FormDeviceSettings): self.btnLockBWSR.setChecked(True) self.btnLockBWSR.setObjectName("btnLockBWSR") self.gridLayout.addWidget(self.btnLockBWSR, 7, 2, 2, 1) - self.labelBandwidth = QtWidgets.QLabel(self.frame_2) - self.labelBandwidth.setObjectName("labelBandwidth") - self.gridLayout.addWidget(self.labelBandwidth, 8, 0, 1, 1) + self.labelGain = QtWidgets.QLabel(self.frame_2) + self.labelGain.setObjectName("labelGain") + self.gridLayout.addWidget(self.labelGain, 9, 0, 1, 1) self.spinBoxBandwidth = KillerDoubleSpinBox(self.frame_2) self.spinBoxBandwidth.setDecimals(3) self.spinBoxBandwidth.setMinimum(0.001) self.spinBoxBandwidth.setMaximum(1000000000000.0) self.spinBoxBandwidth.setObjectName("spinBoxBandwidth") self.gridLayout.addWidget(self.spinBoxBandwidth, 8, 1, 1, 1) - self.labelGain = QtWidgets.QLabel(self.frame_2) - self.labelGain.setObjectName("labelGain") - self.gridLayout.addWidget(self.labelGain, 9, 0, 1, 1) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.gridLayout_5.setObjectName("gridLayout_5") @@ -225,6 +217,19 @@ def setupUi(self, FormDeviceSettings): self.spinBoxNRepeat.setMaximum(999999999) self.spinBoxNRepeat.setObjectName("spinBoxNRepeat") self.gridLayout.addWidget(self.spinBoxNRepeat, 14, 1, 1, 1) + self.labelDeviceIdentifier = QtWidgets.QLabel(self.frame_2) + self.labelDeviceIdentifier.setObjectName("labelDeviceIdentifier") + self.gridLayout.addWidget(self.labelDeviceIdentifier, 1, 0, 1, 1) + self.comboBoxDeviceIdentifier = QtWidgets.QComboBox(self.frame_2) + self.comboBoxDeviceIdentifier.setEditable(False) + self.comboBoxDeviceIdentifier.setInsertPolicy(QtWidgets.QComboBox.NoInsert) + self.comboBoxDeviceIdentifier.setObjectName("comboBoxDeviceIdentifier") + self.gridLayout.addWidget(self.comboBoxDeviceIdentifier, 1, 1, 1, 1) + self.btnRefreshDeviceIdentifier = QtWidgets.QToolButton(self.frame_2) + icon = QtGui.QIcon.fromTheme("view-refresh") + self.btnRefreshDeviceIdentifier.setIcon(icon) + self.btnRefreshDeviceIdentifier.setObjectName("btnRefreshDeviceIdentifier") + self.gridLayout.addWidget(self.btnRefreshDeviceIdentifier, 1, 2, 1, 1) self.gridLayout_6.addWidget(self.frame_2, 0, 0, 1, 1) self.verticalLayout.addWidget(self.groupBoxDeviceSettings) @@ -232,8 +237,7 @@ def setupUi(self, FormDeviceSettings): self.groupBoxDeviceSettings.toggled['bool'].connect(self.frame_2.setVisible) QtCore.QMetaObject.connectSlotsByName(FormDeviceSettings) FormDeviceSettings.setTabOrder(self.groupBoxDeviceSettings, self.cbDevice) - FormDeviceSettings.setTabOrder(self.cbDevice, self.lineEditDeviceArgs) - FormDeviceSettings.setTabOrder(self.lineEditDeviceArgs, self.comboBoxChannel) + FormDeviceSettings.setTabOrder(self.cbDevice, self.comboBoxChannel) FormDeviceSettings.setTabOrder(self.comboBoxChannel, self.comboBoxAntenna) FormDeviceSettings.setTabOrder(self.comboBoxAntenna, self.lineEditIP) FormDeviceSettings.setTabOrder(self.lineEditIP, self.spinBoxPort) @@ -258,9 +262,6 @@ def retranslateUi(self, FormDeviceSettings): self.label_3.setText(_translate("FormDeviceSettings", "Device:")) self.cbDevice.setItemText(0, _translate("FormDeviceSettings", "USRP")) self.cbDevice.setItemText(1, _translate("FormDeviceSettings", "HackRF")) - self.labelDeviceArgs.setToolTip(_translate("FormDeviceSettings", "

If you only have one USRP connected you may leave this field empty, so your USRP gets detected automatically.

If you have multiple USRPs connected or need better control, enter a device identifier of your USRP here.

You may also enter other device arguments here.

")) - self.labelDeviceArgs.setText(_translate("FormDeviceSettings", "Device arguments:")) - self.lineEditDeviceArgs.setToolTip(_translate("FormDeviceSettings", "

If you only have one USRP connected you may leave this field empty, so your USRP gets detected automatically.

If you have multiple USRPs connected or need better control, enter a device identifier of your USRP here.

You may also enter other device arguments here.

")) self.labelChannel.setText(_translate("FormDeviceSettings", "Channel:")) self.labelAntenna.setText(_translate("FormDeviceSettings", "Antenna:")) self.labelIP.setText(_translate("FormDeviceSettings", "IP address:")) @@ -268,8 +269,8 @@ def retranslateUi(self, FormDeviceSettings): self.labelPort.setText(_translate("FormDeviceSettings", "Port number:")) self.labelFreq.setText(_translate("FormDeviceSettings", "Frequency (Hz):")) self.labelSampleRate.setText(_translate("FormDeviceSettings", "Sample rate (Sps):")) - self.btnLockBWSR.setText(_translate("FormDeviceSettings", "...")) self.labelBandwidth.setText(_translate("FormDeviceSettings", "Bandwidth (Hz):")) + self.btnLockBWSR.setText(_translate("FormDeviceSettings", "...")) self.labelGain.setToolTip(_translate("FormDeviceSettings", "

The gain (more exactly RF gain) is the gain applied to the RF signal. This amplifies the high frequent signal arriving at the antenna of your Software Defined Radio.

")) self.labelGain.setText(_translate("FormDeviceSettings", "Gain:")) self.sliderGain.setToolTip(_translate("FormDeviceSettings", "

The gain (more exactly RF gain) is the gain applied to the RF signal. This amplifies the high frequent signal arriving at the antenna of your Software Defined Radio.

")) @@ -290,6 +291,8 @@ def retranslateUi(self, FormDeviceSettings): self.comboBoxDirectSampling.setToolTip(_translate("FormDeviceSettings", "

Set the direct sampling mode. If you do not know what to choose here, just set it to disabled. The native backend is recommended, when using this setting.

")) self.labelNRepeat.setText(_translate("FormDeviceSettings", "Repeat:")) self.spinBoxNRepeat.setSpecialValueText(_translate("FormDeviceSettings", "Infinite")) + self.labelDeviceIdentifier.setText(_translate("FormDeviceSettings", "Device Identifier:")) + self.btnRefreshDeviceIdentifier.setText(_translate("FormDeviceSettings", "...")) from urh.ui.KillerDoubleSpinBox import KillerDoubleSpinBox from . import urh_rc diff --git a/tests/device/HackRFTests.py b/tests/device/HackRFTests.py index 52e1b03b5f..c16907fade 100644 --- a/tests/device/HackRFTests.py +++ b/tests/device/HackRFTests.py @@ -122,6 +122,9 @@ def callback(n): print("close", hackrf.close()) print("exit", hackrf.exit()) + def test_device_list(self): + print(hackrf.get_device_list()) + if __name__ == "__main__": unittest.main() diff --git a/tests/device/TestRTLSDR.py b/tests/device/TestRTLSDR.py index aa9b6e8084..75d4a3bf2f 100644 --- a/tests/device/TestRTLSDR.py +++ b/tests/device/TestRTLSDR.py @@ -9,10 +9,7 @@ util.set_windows_lib_path() from urh.dev.native.RTLSDR import RTLSDR -try: - from urh.dev.native.lib import rtlsdr -except ImportError: - import urh.dev.native.lib.rtlsdr_fallback as rtlsdr +from urh.dev.native.lib import rtlsdr class TestRTLSDR(unittest.TestCase): def test_cython_wrapper(self): diff --git a/tests/device/TestRTLSDRPipe.py b/tests/device/TestRTLSDRPipe.py index fb84d5bb02..a71a41df3f 100644 --- a/tests/device/TestRTLSDRPipe.py +++ b/tests/device/TestRTLSDRPipe.py @@ -4,11 +4,7 @@ from multiprocessing import Process from threading import Thread -try: - from urh.dev.native.lib import rtlsdr -except ImportError: - import urh.dev.native.lib.rtlsdr_fallback as rtlsdr - +from urh.dev.native.lib import rtlsdr import time from urh.util.Logger import logger diff --git a/tests/device/TestUSRP.py b/tests/device/TestUSRP.py index b56eca90c0..8d4561a830 100644 --- a/tests/device/TestUSRP.py +++ b/tests/device/TestUSRP.py @@ -13,6 +13,8 @@ class TestUSRP(unittest.TestCase): def test_cython_wrapper(self): + print(usrp.find_devices("")) + usrp.set_tx(False) return_code = usrp.open("addr=192.168.10.2") diff --git a/tests/test_simulator_dialog.py b/tests/test_simulator_dialog.py index 77409ce8fe..73042734a1 100644 --- a/tests/test_simulator_dialog.py +++ b/tests/test_simulator_dialog.py @@ -68,10 +68,6 @@ def test_set_rx_parameters(self): self.__edit_spinbox_value(rx_settings_widget.ui.spinBoxFreqCorrection, 22) self.assertEqual(simulator.sniffer.rcv_device.freq_correction, 22) - rx_settings_widget.ui.lineEditDeviceArgs.setText("cool args") - rx_settings_widget.ui.lineEditDeviceArgs.editingFinished.emit() - self.assertEqual(simulator.sniffer.rcv_device.device_args, "cool args") - rx_settings_widget.ui.lineEditIP.setText("4.4.4.4") rx_settings_widget.ui.lineEditIP.editingFinished.emit() self.assertEqual(simulator.sniffer.rcv_device.ip, "4.4.4.4") @@ -132,10 +128,6 @@ def test_set_tx_parameters(self): self.__edit_spinbox_value(tx_settings_widget.ui.spinBoxFreqCorrection, 33) self.assertEqual(simulator.sender.device.freq_correction, 33) - tx_settings_widget.ui.lineEditDeviceArgs.setText("cool send args") - tx_settings_widget.ui.lineEditDeviceArgs.editingFinished.emit() - self.assertEqual(simulator.sender.device.device_args, "cool send args") - tx_settings_widget.ui.lineEditIP.setText("1.2.6.2") tx_settings_widget.ui.lineEditIP.editingFinished.emit() self.assertEqual(simulator.sender.device.ip, "1.2.6.2")