From 05edfb93dc27ac014ef75a652be43723061b046c Mon Sep 17 00:00:00 2001 From: Smittix Date: Sat, 28 Feb 2026 14:18:30 +0000 Subject: [PATCH] fix: parse actual board name from hackrf_info for HackRF Pro support Previously all HackRF devices were hardcoded as "HackRF One" regardless of actual hardware variant. Now parses the Board ID line from hackrf_info to correctly identify HackRF Pro, HackRF One, and other variants. Co-Authored-By: Claude Opus 4.6 --- utils/sdr/detection.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/sdr/detection.py b/utils/sdr/detection.py index 2f90d3f..43d93cf 100644 --- a/utils/sdr/detection.py +++ b/utils/sdr/detection.py @@ -347,17 +347,21 @@ def detect_hackrf_devices() -> list[SDRDevice]: ) # Parse hackrf_info output - # Look for "Serial number:" lines - serial_pattern = r'Serial number:\s*(\S+)' + # Extract board name from "Board ID Number: X (Name)" and serial from .hackrf import HackRFCommandBuilder + serial_pattern = r'Serial number:\s*(\S+)' + board_pattern = r'Board ID Number:\s*\d+\s*\(([^)]+)\)' + serials_found = re.findall(serial_pattern, result.stdout) + boards_found = re.findall(board_pattern, result.stdout) for i, serial in enumerate(serials_found): + board_name = boards_found[i] if i < len(boards_found) else 'HackRF' devices.append(SDRDevice( sdr_type=SDRType.HACKRF, index=i, - name=f'HackRF One', + name=board_name, serial=serial, driver='hackrf', capabilities=HackRFCommandBuilder.CAPABILITIES @@ -365,10 +369,12 @@ def detect_hackrf_devices() -> list[SDRDevice]: # Fallback: check if any HackRF found without serial if not devices and 'Found HackRF' in result.stdout: + board_match = re.search(board_pattern, result.stdout) + board_name = board_match.group(1) if board_match else 'HackRF' devices.append(SDRDevice( sdr_type=SDRType.HACKRF, index=0, - name='HackRF One', + name=board_name, serial='Unknown', driver='hackrf', capabilities=HackRFCommandBuilder.CAPABILITIES