Support devices by index when serial number isn't available. - #83
Conversation
|
Thanks! Does this change impact opening a single available RTL-SDR without any arguments? I'm not sure about changing The cache might not work as intended if the usb tree changes. I.e. plug in one RTL-SDR type, discover, then swap for another tuner type, and there will be a mismatch. |
|
Thank you for the feedback! |
|
I don't know of critical SoapySDR API consumers to test. I guess it never properly worked for the interesting devices you use, so that's a win to support those. |
I've checked our other modules and there is prior use of the enumeration index in the label. E.g. HackRF and Pluto use a format of e.g. |
Summary
Add USB enumeration indexes to RTL-SDR discovery and allow devices to be opened by
indexinstead of requiring a unique serial number.This enables reliable use of multi-receiver hardware such as the KerberosSDR and KrakenSDR, whose RTL2832U receivers may expose duplicate or empty serial descriptors. Serial-based selection cannot distinguish those receivers and may repeatedly open the first matching device.
This change is intended to support both the CyberEther desktop application and its WebAssembly/WebUSB application, while remaining generally useful to other SoapySDR clients.
Changes
indexargument for every enumerated RTL-SDR receiver.index.indexwhen opening a receiver so devices with duplicate or empty serials can be selected individually.The Emscripten-specific discovery path intentionally returns a stable label based on the USB enumeration index and avoids optional tuner/string probing. Opening devices during browser discovery can serialize or block WebUSB operations, allowing one active or unresponsive receiver to prevent the remaining receivers from being discovered. Native discovery retains the existing manufacturer, product, serial, and tuner metadata.
Motivation
Multi-receiver products commonly contain several otherwise identical RTL-SDR devices. A serial-only identity is insufficient when their descriptors are duplicated, blank, or unavailable through WebUSB.
For example, CyberEther needs to represent each KerberosSDR or KrakenSDR receiver as a separate selectable source in both its desktop and browser applications. Exposing the librtlsdr enumeration index gives the application an unambiguous selector for each receiver in the current enumeration.
Indexes identify devices within the current librtlsdr enumeration; they are not intended to be persistent physical identifiers across reconnects or system reboots.
Compatibility
Existing callers that select devices by
serialcontinue to work. When both arguments are available,indexis used to open the selected device. The reduced metadata probing behavior is limited to Emscripten builds; native discovery behavior is otherwise preserved.Testing
Tested on Windows with RTL2832U/R820T receivers from a multi-receiver SDR:
Confirmed the
rtlsdrfactory is available throughSoapySDRUtil.Confirmed two connected receivers enumerate independently as
index=0andindex=1, including devices with non-unique serial information.Successfully probed both devices using:
Successfully configured both receivers at 2 MSps.
Measured approximately 1.998 MSps from each receiver during active RX rate tests.
Built and exercised the changes through CyberEther’s native desktop and Emscripten/WebUSB builds.