fix: probe return code check incorrectly blocks valid devices

rtl_test -t often exits non-zero after finding a device (e.g.
"No E4000 tuner found, aborting" with R820T tuners). The return
code fallback was firing even when the "Found N device(s)" success
message had already been matched. Track device_found separately
and only use return code as fallback when no success was seen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-02-27 14:39:39 +00:00
parent 54987e4c8d
commit 7af6d45ca1

View File

@@ -426,6 +426,7 @@ def probe_rtlsdr_device(device_index: int) -> str | None:
import select
error_found = False
device_found = False
deadline = time.monotonic() + 3.0
try:
@@ -451,11 +452,12 @@ def probe_rtlsdr_device(device_index: int) -> str | None:
break
if 'Found' in line and 'device' in line.lower():
# Device opened successfully — no need to wait longer
device_found = True
break
if proc.poll() is not None:
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
if not device_found and not error_found and proc.poll() is not None and proc.returncode != 0:
# rtl_test exited with error and we never saw a success message
error_found = True
finally:
try: