From 7af6d45ca1c91a982237504d169b33a0ba9067b7 Mon Sep 17 00:00:00 2001 From: Smittix Date: Fri, 27 Feb 2026 14:39:39 +0000 Subject: [PATCH] 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 --- utils/sdr/detection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/sdr/detection.py b/utils/sdr/detection.py index 1e49517..f00eb7d 100644 --- a/utils/sdr/detection.py +++ b/utils/sdr/detection.py @@ -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: