From 86ceb7a274e1046b436002946d1111025e766229 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 28 Dec 2019 16:44:45 +0100 Subject: [PATCH] use lists for all command stuff --- owrx/source/__init__.py | 2 +- owrx/source/direct.py | 11 ++++------- owrx/source/fifi_sdr.py | 2 +- owrx/source/hackrf.py | 2 +- owrx/source/resampler.py | 3 +-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/owrx/source/__init__.py b/owrx/source/__init__.py index c42fbf6..cc78fe3 100644 --- a/owrx/source/__init__.py +++ b/owrx/source/__init__.py @@ -135,7 +135,7 @@ class SdrSource(ABC): # preexec_fn can go as soon as there's no piped commands left # the os.killpg call must be replaced with something more reasonable at the same time self.process = subprocess.Popen(shlex.split(cmd), preexec_fn=os.setpgrp) - logger.info("Started rtl source: " + cmd) + logger.info("Started sdr source: " + cmd) available = False diff --git a/owrx/source/direct.py b/owrx/source/direct.py index 0dd338f..a2b26ec 100644 --- a/owrx/source/direct.py +++ b/owrx/source/direct.py @@ -36,21 +36,18 @@ class DirectSource(SdrSource, metaclass=ABCMeta): "These depend on nmux_memory and samp_rate options in config_webrx.py" ) - return "nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % ( + return ["nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % ( nmux_bufsize, nmux_bufcnt, self.port, - ) + )] def getCommand(self): - return super().getCommand() + [ - self.getFormatConversion(), - self.getNmuxCommand(), - ] + return super().getCommand() + self.getFormatConversion() + self.getNmuxCommand() # override this in subclasses, if necessary def getFormatConversion(self): - return None + return [] # override this in subclasses, if necessary def sleepOnRestart(self): diff --git a/owrx/source/fifi_sdr.py b/owrx/source/fifi_sdr.py index c058164..7c65d3b 100644 --- a/owrx/source/fifi_sdr.py +++ b/owrx/source/fifi_sdr.py @@ -13,4 +13,4 @@ class FifiSdrSource(DirectSource): return super().getEventNames() + ["device"] def getFormatConversion(self): - return "csdr convert_s16_f | csdr gain_ff 30" + return ["csdr convert_s16_f", "csdr gain_ff 30"] \ No newline at end of file diff --git a/owrx/source/hackrf.py b/owrx/source/hackrf.py index 0850e11..f689bbc 100644 --- a/owrx/source/hackrf.py +++ b/owrx/source/hackrf.py @@ -22,4 +22,4 @@ class HackrfSource(DirectSource): ] def getFormatConversion(self): - return "csdr convert_s8_f" + return ["csdr convert_s8_f"] diff --git a/owrx/source/resampler.py b/owrx/source/resampler.py index 457c399..327144e 100644 --- a/owrx/source/resampler.py +++ b/owrx/source/resampler.py @@ -33,8 +33,7 @@ class Resampler(DirectSource): "csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING".format( decimation=self.decimation, ddc_transition_bw=self.transition_bw ), - self.getNmuxCommand(), - ] + ] + self.getNmuxCommand() def activateProfile(self, profile_id=None): logger.warning("Resampler does not support setting profiles")