add uhd and redpitaya device modules; switch driver detection to
factories
This commit is contained in:
parent
d07cbb2b10
commit
c30740c4e3
@ -32,6 +32,8 @@ class FeatureDetector(object):
|
|||||||
"fifi_sdr": ["alsa"],
|
"fifi_sdr": ["alsa"],
|
||||||
"pluto_sdr": ["soapy_connector", "soapy_pluto_sdr"],
|
"pluto_sdr": ["soapy_connector", "soapy_pluto_sdr"],
|
||||||
"soapy_remote": ["soapy_connector", "soapy_remote"],
|
"soapy_remote": ["soapy_connector", "soapy_remote"],
|
||||||
|
"uhd": ["soapy_connector", "soapy_uhd"],
|
||||||
|
"red_pitaya": ["soapy_connector", "soapy_red_pitaya"],
|
||||||
# optional features and their requirements
|
# optional features and their requirements
|
||||||
"digital_voice_digiham": ["digiham", "sox"],
|
"digital_voice_digiham": ["digiham", "sox"],
|
||||||
"digital_voice_dsd": ["dsd", "sox", "digiham"],
|
"digital_voice_dsd": ["dsd", "sox", "digiham"],
|
||||||
@ -244,14 +246,16 @@ class FeatureDetector(object):
|
|||||||
def _has_soapy_driver(self, driver):
|
def _has_soapy_driver(self, driver):
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(["SoapySDRUtil", "--info"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
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):
|
drivers = []
|
||||||
matches = driverRegex.match(line.decode())
|
for line in process.stdout:
|
||||||
return matches is not None and matches.group(1) == driver
|
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 driver in drivers
|
||||||
return reduce(or_, lines, False)
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -270,7 +274,7 @@ class FeatureDetector(object):
|
|||||||
|
|
||||||
You can get it [here](https://github.com/pothosware/SoapySDRPlay/wiki).
|
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):
|
def has_soapy_airspy(self):
|
||||||
"""
|
"""
|
||||||
@ -295,7 +299,7 @@ class FeatureDetector(object):
|
|||||||
|
|
||||||
You can get it [here](https://github.com/myriadrf/LimeSuite).
|
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):
|
def has_soapy_pluto_sdr(self):
|
||||||
"""
|
"""
|
||||||
@ -303,7 +307,7 @@ class FeatureDetector(object):
|
|||||||
|
|
||||||
You can get it [here](https://github.com/photosware/SoapyPlutoSDR).
|
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):
|
def has_soapy_remote(self):
|
||||||
"""
|
"""
|
||||||
@ -313,6 +317,22 @@ class FeatureDetector(object):
|
|||||||
"""
|
"""
|
||||||
return self._has_soapy_driver("remote")
|
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):
|
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
|
The digital voice modes NXDN and D-Star can be decoded by the dsd project. Please note that you need the version
|
||||||
|
6
owrx/source/red_pitaya.py
Normal file
6
owrx/source/red_pitaya.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from .soapy import SoapyConnectorSource
|
||||||
|
|
||||||
|
|
||||||
|
class RedPitayaSource(SoapyConnectorSource):
|
||||||
|
def getDriver(self):
|
||||||
|
return "redpitaya"
|
6
owrx/source/uhd.py
Normal file
6
owrx/source/uhd.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from .soapy import SoapyConnectorSource
|
||||||
|
|
||||||
|
|
||||||
|
class UhdSource(SoapyConnectorSource):
|
||||||
|
def getDriver(self):
|
||||||
|
return "uhd"
|
Loading…
Reference in New Issue
Block a user