mirror of
https://github.com/smittix/intercept.git
synced 2026-04-29 00:59:59 -07:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user