From 7898c3d61a1e82fb25d7cdf523aec1c882a1cb0e Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sat, 21 Mar 2026 15:32:46 +0100 Subject: [PATCH] [fix](trx-backend-soapysdr): enumerate available devices on match failure for diagnostics When Device::new(args) fails, enumerate all available SoapySDR devices and include them in the error message. Also hint that args are case-sensitive. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stan Grams --- .../trx-backend-soapysdr/src/real_iq_source.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/trx-server/trx-backend/trx-backend-soapysdr/src/real_iq_source.rs b/src/trx-server/trx-backend/trx-backend-soapysdr/src/real_iq_source.rs index 0603274..a93bc80 100644 --- a/src/trx-server/trx-backend/trx-backend-soapysdr/src/real_iq_source.rs +++ b/src/trx-server/trx-backend/trx-backend-soapysdr/src/real_iq_source.rs @@ -62,11 +62,21 @@ impl RealIqSource { // particular device and silently opening a different one would cause // incorrect behaviour (especially with multiple devices). Device::new(args).map_err(|e| { + // Enumerate all available devices to help diagnose the mismatch. + let available = match soapysdr::enumerate("") { + Ok(devs) if !devs.is_empty() => { + let list: Vec = devs.iter().map(|d| format!("{}", d)).collect(); + format!("Available devices:\n {}", list.join("\n ")) + } + Ok(_) => "No SoapySDR devices found.".to_string(), + Err(enum_err) => format!("(could not enumerate devices: {})", enum_err), + }; format!( "Failed to open SoapySDR device with args '{}': {}\n \ - Troubleshooting: Verify the device is connected and the args are correct. \ + {}\n \ + Hint: SoapySDR args are case-sensitive (e.g. 'driver=airspyhf' not 'driver=AirspyHF').\n \ Run SoapySDRUtil --find to list available devices and their identifiers.", - args, e + args, e, available ) })? };