From e90973bcd45b15c44b513de3f3d01d5a36fe9a14 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 30 May 2020 22:58:31 +0200 Subject: [PATCH] switch hackrf to soapy --- CHANGELOG.md | 3 ++- owrx/feature.py | 30 +++++++++--------------------- owrx/source/hackrf.py | 23 ++++------------------- 3 files changed, 15 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bf8754..5f77877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,8 @@ - Improve receiver load time by concatenating javascript assets - Docker images migrated to Debian slim images; This was necessary to allow the use of function multiversioning in csdr and owrx_connector to allow the images to run on a wider range of CPUs -- Docker containers have been updated to include the SDRplay driver version 3 +- Docker containers have been updated to include the SDRplay driver version 3 +- HackRF support is now based on SoapyHackRF **0.18.0** - Support for SoapyRemote diff --git a/owrx/feature.py b/owrx/feature.py index 06eb4f5..9b31001 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -24,7 +24,7 @@ class FeatureDetector(object): "rtl_sdr": ["rtl_connector"], "rtl_sdr_soapy": ["soapy_connector", "soapy_rtl_sdr"], "sdrplay": ["soapy_connector", "soapy_sdrplay"], - "hackrf": ["hackrf_transfer"], + "hackrf": ["soapy_connector", "soapy_hackrf"], "perseussdr": ["perseustest"], "airspy": ["soapy_connector", "soapy_airspy"], "airspyhf": ["soapy_connector", "soapy_airspyhf"], @@ -127,26 +127,6 @@ class FeatureDetector(object): """ return self.command_is_runnable("nc --help") - def has_hackrf_transfer(self): - """ - To use a HackRF, compile the HackRF host tools from its "stdout" branch: - ``` - git clone https://github.com/mossmann/hackrf/ - cd hackrf - git fetch - git checkout origin/stdout - cd host - mkdir build - cd build - cmake .. -DINSTALL_UDEV_RULES=ON - make - sudo make install - ``` - """ - # TODO i don't have a hackrf, so somebody doublecheck this. - # TODO also check if it has the stdout feature - return self.command_is_runnable("hackrf_transfer --help") - def has_perseustest(self): """ To use a Microtelecom Perseus HF receiver, compile and @@ -333,6 +313,14 @@ class FeatureDetector(object): """ return self._has_soapy_driver("redpitaya") + def has_soapy_hackrf(self): + """ + The SoapyHackRF allows HackRF to be used with SoapySDR. + + You can get it [here](https://github.com/pothosware/SoapyHackRF/wiki). + """ + return self._has_soapy_driver("hackrf") + def has_dsd(self): """ The digital voice modes NXDN and D-Star can be decoded by the dsd project. Please note that you need the version diff --git a/owrx/source/hackrf.py b/owrx/source/hackrf.py index f59a448..02547f7 100644 --- a/owrx/source/hackrf.py +++ b/owrx/source/hackrf.py @@ -1,23 +1,8 @@ -from .direct import DirectSource +from .soapy import SoapyConnectorSource from owrx.command import Option import time -class HackrfSource(DirectSource): - def getCommandMapper(self): - return super().getCommandMapper().setBase("hackrf_transfer").setMappings( - { - "samp_rate": Option("-s"), - "tuner_freq": Option("-f"), - "rf_gain": Option("-g"), - "lna_gain": Option("-l"), - "rf_amp": Option("-a"), - "ppm": Option("-C"), - } - ).setStatic("-r-") - - def getFormatConversion(self): - return ["csdr convert_s8_f"] - - def sleepOnRestart(self): - time.sleep(1) +class HackrfSource(SoapyConnectorSource): + def getDriver(self): + return "hackrf" \ No newline at end of file