Skip to content
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.

Commit

Permalink
add uhd and redpitaya device modules; switch driver detection to
Browse files Browse the repository at this point in the history
factories
  • Loading branch information
jketterl committed Apr 10, 2020
1 parent d07cbb2 commit c30740c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
38 changes: 29 additions & 9 deletions owrx/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class FeatureDetector(object):
"fifi_sdr": ["alsa"],
"pluto_sdr": ["soapy_connector", "soapy_pluto_sdr"],
"soapy_remote": ["soapy_connector", "soapy_remote"],
"uhd": ["soapy_connector", "soapy_uhd"],
"red_pitaya": ["soapy_connector", "soapy_red_pitaya"],
# optional features and their requirements
"digital_voice_digiham": ["digiham", "sox"],
"digital_voice_dsd": ["dsd", "sox", "digiham"],
Expand Down Expand Up @@ -244,14 +246,16 @@ def has_soapy_connector(self):
def _has_soapy_driver(self, driver):
try:
process = subprocess.Popen(["SoapySDRUtil", "--info"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
driverRegex = re.compile("^Module found: .*lib(.*)Support.so")
factory_regex = re.compile("^Available factories\\.\\.\\. (.*)$")

def matchLine(line):
matches = driverRegex.match(line.decode())
return matches is not None and matches.group(1) == driver
drivers = []
for line in process.stdout:
matches = factory_regex.match(line.decode())
if matches:
drivers = [s.strip() for s in matches[1].split(", ")]
logger.debug(drivers)

lines = [matchLine(line) for line in process.stdout]
return reduce(or_, lines, False)
return driver in drivers
except FileNotFoundError:
return False

Expand All @@ -270,7 +274,7 @@ def has_soapy_sdrplay(self):
You can get it [here](https://github.com/pothosware/SoapySDRPlay/wiki).
"""
return self._has_soapy_driver("sdrPlay")
return self._has_soapy_driver("sdrplay")

def has_soapy_airspy(self):
"""
Expand All @@ -295,15 +299,15 @@ def has_soapy_lime_sdr(self):
You can get it [here](https://github.com/myriadrf/LimeSuite).
"""
return self._has_soapy_driver("LMS7")
return self._has_soapy_driver("lime")

def has_soapy_pluto_sdr(self):
"""
The SoapySDR module for PlutoSDR devices is required for interfacing with PlutoSDR devices.
You can get it [here](https://github.com/photosware/SoapyPlutoSDR).
"""
return self._has_soapy_driver("PlutoSDR")
return self._has_soapy_driver("plutosdr")

def has_soapy_remote(self):
"""
Expand All @@ -313,6 +317,22 @@ def has_soapy_remote(self):
"""
return self._has_soapy_driver("remote")

def has_soapy_uhd(self):
"""
The SoapyUHD module allows using UHD / USRP devices with SoapySDR.
You can get it [here](https://github.com/pothosware/SoapyUHD/wiki).
"""
return self._has_soapy_driver("uhd")

def has_soapy_red_pitaya(self):
"""
The SoapyRedPitaya allows Red Pitaya deviced to be used with SoapySDR.
You can get it [here](https://github.com/pothosware/SoapyRedPitaya/wiki).
"""
return self._has_soapy_driver("redpitaya")

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
Expand Down
6 changes: 6 additions & 0 deletions owrx/source/red_pitaya.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .soapy import SoapyConnectorSource


class RedPitayaSource(SoapyConnectorSource):
def getDriver(self):
return "redpitaya"
6 changes: 6 additions & 0 deletions owrx/source/uhd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .soapy import SoapyConnectorSource


class UhdSource(SoapyConnectorSource):
def getDriver(self):
return "uhd"

0 comments on commit c30740c

Please sign in to comment.