#hardware-abstraction-layer #abstraction-layer #radio #sdr #api-bindings

bin+lib soapysdr

Library wrapping SoapySDR, a hardware abstraction layer for many software defined radio devices, including rtl-sdr, HackRF, USRP, LimeSDR, BladeRF, and Airspy

8 releases

0.4.1 Oct 21, 2024
0.4.0 Oct 21, 2023
0.3.3 Jul 8, 2023
0.3.2 Feb 23, 2022
0.1.0 Nov 13, 2018

#44 in Hardware support

Download history 340/week @ 2024-08-01 404/week @ 2024-08-08 342/week @ 2024-08-15 372/week @ 2024-08-22 503/week @ 2024-08-29 266/week @ 2024-09-05 186/week @ 2024-09-12 202/week @ 2024-09-19 285/week @ 2024-09-26 402/week @ 2024-10-03 336/week @ 2024-10-10 476/week @ 2024-10-17 370/week @ 2024-10-24 380/week @ 2024-10-31 403/week @ 2024-11-07 543/week @ 2024-11-14

1,755 downloads per month
Used in 6 crates (5 directly)

BSL-1.0 OR Apache-2.0

80KB
1.5K SLoC

Rust bindings for SoapySDR

SoapySDR provides a hardware abstraction layer for many software defined radio devices.

API Documentation | Changelog

Dependencies

This library requires dependencies not handled by Cargo:

  • libsoapysdr 0.6, 0.7, or 0.8
  • libclang 5.0+ (for bindgen)
  • pkg-config

Ubuntu

(Tested on Ubuntu 22.04)

sudo apt install libsoapysdr-dev libclang-dev llvm-dev pkg-config

# Choose the appropriate drivers for your hardware:
sudo apt install soapysdr-module-rtlsdr soapysdr-module-hackrf soapysdr-module-uhd soapysdr-module-lms7

Nix

nix-shell

(see shell.nix)

Windows

Install pre-built PothosSDR and LLVM, then

  • Set LIBCLANG_PATH environment variable to LLVM bin directory for rust-bindgen
  • Add PothosSDR bin directory to system PATH

Warning

Many SoapySDR driver modules have error handling and thread safety bugs. This library provides safe Rust wrappers assuming the drivers meet the (under-documented) intentions of the SoapySDR core API contract, but if SoapySDR loads modules that violate this contract and you do atypical things with them, you may encounter unexpected behavior. For details, see this SoapySDR issue.

Utilities

This crate comes with two small utilities that serve as example code.

soapy-sdr-info

Displays device details like SoapySDRUtil.

cargo run --release --features=binaries --bin soapy-sdr-info

soapy-sdr-stream

Records data from a device.

e.g. capture 15 seconds of data from the FM band:

cargo run --release --features=binaries --bin soapy-sdr-stream -- -d driver=rtlsdr -r out.cfile -f 96M -s 1M -n 15M

The resulting file contains 32-bit little-endian complex float samples, and can be opened with inspectrum.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.3–3.5MB
~61K SLoC