#[non_exhaustive]pub enum TunerError {
PllNotLocked {
freq_hz: u32,
},
XtalIsZero,
PllProgrammingFailed {
backend: &'static str,
freq_hz: u32,
reason: &'static str,
},
I2cTransferFailed {
operation: &'static str,
got: usize,
expected: usize,
},
ShadowCacheMiss {
reg: u8,
},
UnsupportedFilterBandwidth {
mode: u8,
},
InvalidGain {
what: &'static str,
detail: String,
},
Context {
context: &'static str,
source: Box<TunerError>,
},
}Expand description
Typed sub-variant of RtlSdrError::Tuner.
Since 0.2, tuner-side failures carry this enum instead of a
stringly-typed String. Consumers can match on the variants
to discriminate failure modes (e.g. retry on
PllNotLocked, fail-fast on XtalIsZero).
Some variants carry a &'static str backend field naming
the IC family ("R82xx", "FC0012", "FC0013", "E4K",
"FC2580"); use it to disambiguate when the same failure
shape can happen on multiple ICs.
#[non_exhaustive] so adding a new variant in any future
patch release is non-breaking. Per #16.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PllNotLocked
PLL did not achieve lock for the requested LO frequency within the IC’s retry budget. Usually means the frequency is at an awkward divider boundary or the crystal/clock is misconfigured. Backends: R82xx, E4K.
XtalIsZero
The configured crystal reference is zero, which would divide-by-zero in PLL math. Backends: R82xx (general), FC2580 (more specifically “crystal frequency too low”).
PllProgrammingFailed
PLL programming failed for an IC-specific reason that
doesn’t share a common shape with other backends. Catch-
all for “no valid divider found”, “computed PLL value
exceeds register range”, “VCO out of range”, etc. The
reason carries a static diagnostic string identifying
the specific failure.
Backends: R82xx, FC0012, FC0013, FC2580, E4K.
I2cTransferFailed
I2C transfer to the tuner returned fewer bytes than
expected. operation names which step failed
("write", "read addr", "read data").
ShadowCacheMiss
R82xx: register read attempted before the shadow cache
was populated. Indicates a programming error in the
crate (caller used the helper before init), not a
hardware fault.
UnsupportedFilterBandwidth
FC2580: the configured filter-bandwidth mode index
doesn’t match any supported bandwidth in the IC’s LUT.
mode is the internal mode tag (not a Hz value).
InvalidGain
Gain parameter out of valid range. what names the
parameter ("E4K IF gain stage", "E4K mixer gain",
"E4K enhancement gain", etc.) and detail is a
human-readable specifier describing the bad value.
Backends: E4K (the only IC with multi-stage gain that
validates per stage).
Context
Operation context wrapper. Used to add a &'static str
prefix (e.g. "filter calibration") to an inner
TunerError without losing the typed inner variant.
#[source] makes the inner error walkable via
std::error::Error::source for consumers using
anyhow-style chained-error UI.
Coverage caveat (per audit pass-2 #74): Context
only wraps TunerError — by construction it can’t carry
a Usb(rusb::Error) or DeviceLost from the same
operation. The R82xx filter-calibration path uses this
shape today: failures from the calibration’s tuner-side
math get wrapped (Context { context: "filter calibration", source: ... }), but a USB transport error
during the same calibration sequence propagates as a
bare RtlSdrError::Usb(...) with no calibration-context
breadcrumb. Consumers building diagnostic UIs should
match on both shapes if they want full coverage of the
“what was the device doing when it failed” question.
Trait Implementations§
Source§impl Clone for TunerError
impl Clone for TunerError
Source§fn clone(&self) -> TunerError
fn clone(&self) -> TunerError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TunerError
impl Debug for TunerError
Source§impl Display for TunerError
impl Display for TunerError
Source§impl Error for TunerError
impl Error for TunerError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<TunerError> for RtlSdrError
impl From<TunerError> for RtlSdrError
Source§fn from(source: TunerError) -> Self
fn from(source: TunerError) -> Self
Source§impl PartialEq for TunerError
impl PartialEq for TunerError
Source§fn eq(&self, other: &TunerError) -> bool
fn eq(&self, other: &TunerError) -> bool
self and other values to be equal, and is used by ==.