mirror of
https://github.com/smittix/intercept.git
synced 2026-04-26 07:40:01 -07:00
fix: ADS-B probe incorrectly treats "No devices found" as success
The success check ('Found' in line and 'device' in line) matched
"No supported devices found" since both keywords appear. Add a
pre-check for negative device messages, a return code fallback,
and a clearer error message.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -441,6 +441,11 @@ def probe_rtlsdr_device(device_index: int) -> str | None:
|
|||||||
line = proc.stderr.readline()
|
line = proc.stderr.readline()
|
||||||
if not line:
|
if not line:
|
||||||
break # EOF — process closed stderr
|
break # EOF — process closed stderr
|
||||||
|
# Check for no-device messages first (before success check,
|
||||||
|
# since "No supported devices found" also contains "Found" + "device")
|
||||||
|
if 'no supported devices' in line.lower() or 'no matching devices' in line.lower():
|
||||||
|
error_found = True
|
||||||
|
break
|
||||||
if 'usb_claim_interface' in line or 'Failed to open' in line:
|
if 'usb_claim_interface' in line or 'Failed to open' in line:
|
||||||
error_found = True
|
error_found = True
|
||||||
break
|
break
|
||||||
@@ -449,6 +454,9 @@ def probe_rtlsdr_device(device_index: int) -> str | None:
|
|||||||
break
|
break
|
||||||
if proc.poll() is not None:
|
if proc.poll() is not None:
|
||||||
break # Process exited
|
break # Process exited
|
||||||
|
if proc.poll() is not None and proc.returncode != 0 and not error_found:
|
||||||
|
# rtl_test exited with error but we didn't match a specific keyword
|
||||||
|
error_found = True
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
proc.kill()
|
proc.kill()
|
||||||
@@ -462,10 +470,8 @@ def probe_rtlsdr_device(device_index: int) -> str | None:
|
|||||||
f"device busy or unavailable"
|
f"device busy or unavailable"
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
f'SDR device {device_index} is busy at the USB level — '
|
f'SDR device {device_index} is not available — '
|
||||||
f'another process outside INTERCEPT may be using it. '
|
f'check that the RTL-SDR is connected and not in use by another process.'
|
||||||
f'Check for stale rtl_fm/rtl_433/dump1090 processes, '
|
|
||||||
f'or try a different device.'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user