Reduce repeated ADS-B device probes

This commit is contained in:
James Smith
2026-03-19 07:55:19 +00:00
parent 334146b799
commit cb0fb4f3be
2 changed files with 100 additions and 111 deletions

View File

@@ -767,23 +767,14 @@ def check_adsb_tools():
has_readsb = shutil.which('readsb') is not None
has_rtl_adsb = shutil.which('rtl_adsb') is not None
# Check what SDR hardware is detected
devices = SDRFactory.detect_devices()
has_rtlsdr = any(d.sdr_type == SDRType.RTL_SDR for d in devices)
has_soapy_sdr = any(d.sdr_type in (SDRType.HACKRF, SDRType.LIME_SDR, SDRType.AIRSPY) for d in devices)
soapy_types = [d.sdr_type.value for d in devices if d.sdr_type in (SDRType.HACKRF, SDRType.LIME_SDR, SDRType.AIRSPY)]
# Determine if readsb is needed but missing
needs_readsb = has_soapy_sdr and not has_readsb
return jsonify({
'dump1090': has_dump1090,
'readsb': has_readsb,
'rtl_adsb': has_rtl_adsb,
'has_rtlsdr': has_rtlsdr,
'has_soapy_sdr': has_soapy_sdr,
'soapy_types': soapy_types,
'needs_readsb': needs_readsb
'has_rtlsdr': None,
'has_soapy_sdr': None,
'soapy_types': [],
'needs_readsb': False
})