Skip to main content

Crate libairspy_rs

Crate libairspy_rs 

Source
Expand description

Pure-Rust port of libairspy — USB driver for the Airspy R2 / Mini software-defined radio receivers, with no C library dependency.

This is a faithful port: USB wire behavior, sample-pipeline semantics, and DSP output match the original C library, behind an idiomatic Rust surface (RAII device handles, Result-based errors, typed enums, and Iterator/Stream-based sample delivery).

The crate is under active construction; the conversion is tracked in milestones on GitHub.

Re-exports§

pub use board::PartIdSerial;
pub use conversion::Samples;
pub use device::Device;
pub use device::list_devices;
pub use error::Error;
pub use error::Result;

Modules§

board
Board information reads, ported from airspy_board_id_read, airspy_version_string_read, and airspy_board_partid_serialno_read in airspy.c.
commands
Wire-level constants and enums shared with the Airspy firmware, transcribed from airspy_commands.h and airspy.h.
conversion
Sample-format conversion, starting with the 12-bit packed-mode unpacker (unpack_samples in airspy.c). The IQ converters land here with the DSP milestone.
device
Device enumeration and lifecycle, ported from airspy.c’s airspy_list_devices / airspy_open_device / airspy_open_exit.
error
Error type mirroring enum airspy_error from airspy.h.
reader
Blocking Iterator sample delivery — the sync alternative to the crate::Device::start_rx callback, mirroring librtlsdr-rs’s reader shape. Blocks are bridged off the consumer thread over a bounded channel; when the iterator falls behind, the channel fills, the consumer stalls, and the ring’s C drop accounting takes over.
stream
The bulk-transfer streaming engine, ported from airspy.c’s transfer machinery: airspy_start_rx / airspy_stop_rx / airspy_is_streaming, the libusb transfer callback’s 8-slot swap ring, and the producer/consumer thread pair.
stream_smol
Smol Stream adapter — gated on feature = "smol", mirroring librtlsdr-rs’s per-runtime bridge shape (async-channel’s Receiver already implements Stream; blocking is not needed because this engine owns its own threads).
stream_tokio
Tokio Stream adapter — gated on feature = "tokio", mirroring librtlsdr-rs’s per-runtime bridge shape.

Structs§

LibVersion
Library version, mirroring airspy_lib_version / airspy_lib_version_t — reporting this crate’s own version rather than the C library’s 1.0.12.

Functions§

lib_version
The version of this crate (airspy_lib_version semantics).