Skip to main content

usb_stack/host/
error.rs

1//! Errors reported by the host stack.
2
3/// What went wrong on the host side.
4#[derive(Clone, Copy, PartialEq, Eq, Debug)]
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6pub enum HostError {
7    /// Every host channel is in use.
8    NoChannel,
9    /// The device did not answer within the retry budget.
10    Timeout,
11    /// The endpoint answered with a STALL handshake.
12    Stall,
13    /// A transaction kept failing (CRC, bit stuff, false EOP) and the retries
14    /// were used up.
15    Transaction,
16    /// Nothing is attached to the port, or the device went away.
17    Disconnected,
18    /// The buffer is too small for the reply or larger than a packet of the
19    /// endpoint.
20    Overflow,
21    /// A descriptor or a reply does not follow the USB grammar.
22    Malformed,
23    /// The device answered something the protocol does not allow here.
24    Protocol,
25    /// The controller cannot do what was asked (isochronous endpoints, for
26    /// example).
27    Unsupported,
28}
29
30/// Result alias for the host stack.
31pub type HostResult<T> = Result<T, HostError>;