From 113c06fae4f9c3489a3b86eb2bdd2f46307af0b9 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 9 Jan 2021 19:19:53 +0100 Subject: [PATCH] introduce separate wsjt-x version check based on wsjtx_app_version --- owrx/feature.py | 21 +++++++++++++++++++++ owrx/modes.py | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/owrx/feature.py b/owrx/feature.py index fbdb425..1a37494 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -77,6 +77,7 @@ class FeatureDetector(object): "digital_voice_freedv": ["freedv_rx", "sox"], "digital_voice_m17": ["m17_demod", "sox"], "wsjt-x": ["wsjtx", "sox"], + "wsjt-x-2-3": ["wsjtx_2_3", "sox"], "packet": ["direwolf", "sox"], "pocsag": ["digiham", "sox"], "js8call": ["js8", "sox"], @@ -459,6 +460,26 @@ class FeatureDetector(object): """ return reduce(and_, map(self.command_is_runnable, ["jt9", "wsprd"]), True) + def _has_wsjtx_version(self, required_version): + wsjt_version_regex = re.compile("^WSJT-X (.*)$") + + try: + process = subprocess.Popen(["wsjtx_app_version", "--version"], stdout=subprocess.PIPE) + matches = wsjt_version_regex.match(process.stdout.readline().decode()) + if matches is None: + return False + version = LooseVersion(matches.group(1)) + process.wait(1) + return version >= required_version + except FileNotFoundError: + return False + + def has_wsjtx_2_3(self): + """ + Newer digital modes (e.g. FST4, FST4) require WSJT-X in at least version 2.3. + """ + return self.has_wsjtx() and self._has_wsjtx_version(LooseVersion("2.3")) + def has_js8(self): """ To decode JS8, you will need to install [JS8Call](http://js8call.com/) diff --git a/owrx/modes.py b/owrx/modes.py index 8b642e1..a9ce30f 100644 --- a/owrx/modes.py +++ b/owrx/modes.py @@ -75,8 +75,8 @@ class Modes(object): DigitalMode( "wspr", "WSPR", underlying=["usb"], bandpass=Bandpass(1350, 1650), requirements=["wsjt-x"], service=True ), - DigitalMode("fst4", "FST4", underlying=["usb"], bandpass=Bandpass(0, 3000), requirements=["wsjt-x"], service=True), - DigitalMode("fst4w", "FST4W", underlying=["usb"], bandpass=Bandpass(1350, 1650), requirements=["wsjt-x"], service=True), + DigitalMode("fst4", "FST4", underlying=["usb"], bandpass=Bandpass(0, 3000), requirements=["wsjt-x-2-3"], service=True), + DigitalMode("fst4w", "FST4W", underlying=["usb"], bandpass=Bandpass(1350, 1650), requirements=["wsjt-x-2-3"], service=True), DigitalMode("js8", "JS8Call", underlying=["usb"], bandpass=Bandpass(0, 3000), requirements=["js8call"], service=True), DigitalMode( "packet",