#sdr #ffi #hardware-abstraction-layer #radio #bindings #abstraction-layer #defined

sys soapysdr-sys

Bindings for the C API of SoapySDR, the vendor-neutral software defined radio hardware abstraction layer

8 releases

0.7.5 Jul 8, 2023
0.7.4 Feb 19, 2023
0.7.3 Oct 17, 2021
0.7.2 Apr 17, 2021
0.5.0 Mar 19, 2017

#1271 in Hardware support

Download history 143/week @ 2024-06-01 106/week @ 2024-06-08 295/week @ 2024-06-15 164/week @ 2024-06-22 130/week @ 2024-06-29 280/week @ 2024-07-06 367/week @ 2024-07-13 355/week @ 2024-07-20 448/week @ 2024-07-27 405/week @ 2024-08-03 400/week @ 2024-08-10 370/week @ 2024-08-17 389/week @ 2024-08-24 447/week @ 2024-08-31 234/week @ 2024-09-07 185/week @ 2024-09-14

1,361 downloads per month
Used in 7 crates (via soapysdr)

BSL-1.0/Apache-2.0

7KB
104 lines

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.


lib.rs:

This crate provides bindings for the SoapySDR C API. See its header file for API documentation.

No runtime deps

~0–2.4MB
~40K SLoC