Skip to content

Add support for multi-sdr receiver devices like KrakenSDR or KerberosSDR - #300

Draft
ooeygui wants to merge 2 commits into
luigifcruz:mainfrom
ooeygui:feature/multi_sdr
Draft

ooeygui wants to merge 2 commits into
luigifcruz:mainfrom
ooeygui:feature/multi_sdr

Conversation

@ooeygui

@ooeygui ooeygui commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Add support for selecting individual RTL-SDR receivers by USB enumeration index, including multi-receiver devices such as the KerberosSDR and KrakenSDR.

This also adds the browser-side WebUSB authorization and reliability handling needed to use these receivers from the CyberEther WebAssembly application. The same index-based selection works in the native desktop application.

Motivation

Multi-receiver SDRs contain several RTL2832U devices that may expose duplicate, empty, or otherwise unreliable serial descriptors. CyberEther previously depended on SoapyRTLSDR's serial-based identity, which could cause multiple entries to resolve to the same physical receiver or prevent serial-less receivers from being selected at all.

The browser application had additional constraints:

  • WebUSB access must be initiated by a user gesture.
  • Authorized devices were not automatically reflected in the Soapy device list.
  • Discovery could open every receiver to collect metadata, allowing one active or unresponsive receiver to block the others.
  • Repeated libusb contexts and overlapping browser promises could leave device operations stalled.
  • Reading RTL2832U descriptors through raw control transfers was unreliable in Chromium.

Changes

Multi-receiver selection

  • Use the SoapyRTLSDR index argument to identify and open individual receivers.
  • Track a WebUSB refresh generation in the Soapy block configuration.
  • Re-enumerate devices after browser authorization.
  • Pull the index-enabled SoapyRTLSDR implementation from the feature/by_index branch pending its upstream PR.

The enumeration index identifies a receiver within the current librtlsdr device list. It is not intended to remain a persistent physical identifier after reconnecting devices or rebooting the system.

WebUSB authorization

  • Add an Authorize SDR Device control to the browser Soapy configuration UI.
  • Dispatch navigator.usb.requestDevice() on the browser main thread.
  • Filter the chooser for common SDR vendor/class identifiers.
  • Refresh the available Soapy devices after authorization completes.
  • Ignore chooser cancellation while reporting other authorization failures to the browser console.

Browser USB reliability

  • Share one process-wide libusb context in librtlsdr under Emscripten.
  • Add bounded WebUSB open and close operations with recoverable promise chains.
  • Construct RTL2832U libusb descriptors from WebUSB metadata instead of issuing unreliable raw descriptor control transfers.
  • Serialize control transfers per device so C-side timeouts do not allow underlying browser promises to overlap.
  • Add short pacing and one retry for transient RTL2832U NetworkError failures.

These workarounds are scoped to the Emscripten/WebUSB paths and do not alter native libusb behavior.

Why this is a draft

This PR depends on index-based device selection that is not yet available in an upstream SoapyRTLSDR release. The required changes are currently maintained on: https://github.com/ooeygui/SoapyRTLSDR/tree/feature/by_index

A separate upstream SoapyRTLSDR PR will add cross-platform discovery and opening by USB enumeration index while preserving serial-based selection for compatibility.

CyberEther temporarily tracks that development branch so the complete desktop and WebAssembly integration can be reviewed and tested together. This PR should remain a draft until the SoapyRTLSDR change is accepted and CyberEther can reference an upstream commit or release instead of a contributor fork.

Depends on: pothosware/SoapyRTLSDR#83

Testing

Tested on Windows with RTL2832U/R820T receivers in a KerberosSDR:

  • Built the native CyberEther application.
  • Built the Emscripten/WebGPU application with the WebUSB patches.
  • Ran the native Soapy block/module tests, including serialization of the WebUSB refresh state.
  • Confirmed browser authorization refreshes the SDR device list.
  • Confirmed two enabled receivers enumerate independently as  index=0  and  index=1 .
  • Probed both indexes successfully through  SoapySDRUtil .
  • Configured both receivers at an exact rate of approximately 2 MSps.
  • Measured approximately 2 MSps from each receiver during active native RX tests.
  • Confirmed the browser path completes sample-rate setup and reaches stream-format initialization.

Known limitations

  • WebUSB permissions are specific to the browser profile and origin.
  • Abruptly reloading or closing the page can terminate the Emscripten worker before librtlsdr releases the receiver cleanly.
  • Chromium cannot reset these RTL2832U devices through  USBDevice.reset()  on Windows. A receiver left in a faulted state may require disconnecting it or resetting/conditioning it through native libusb before another browser session.
  • Repeated abrupt browser reload stress remains less reliable than orderly graph/device shutdown.
  • I do not have a KrakenSDR, so unable to validate assumptions about indexes and serial numbers, but this change should be resilient.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants