embassy-usb-host

Crates

git

Versions

default

Flavors

HubHandler

Struct HubHandler 

Source
pub struct HubHandler<'d, A: UsbHostAllocator<'d>, const MAX_PORTS: usize> { /* private fields */ }

Implementations§

Source§

impl<'d, A: UsbHostAllocator<'d>, const MAX_PORTS: usize> HubHandler<'d, A, MAX_PORTS>

Source

pub async fn try_register( bus: &BusHandle<'d, A>, enum_info: &EnumerationInfo, ) -> Result<Self, RegisterError>

Attempt to register a hub handler for the given device.

Source

pub async fn wait_for_event( &mut self, ) -> Result<HandlerEvent<HubEvent>, HostError>

Wait for a hub port status change event.

Source

pub async fn enumerate_port( &mut self, config_buffer: &mut [u8], port: u8, speed: Speed, ) -> Result<(EnumerationInfo, usize), EnumerationError>

Reset a port and enumerate the device attached to it.

port and speed are the 0-based port index and device speed as reported by HubEvent::DeviceDetected. Enumeration uses the BusHandle the hub was registered with.

Returns the EnumerationInfo for the device and bytes written to config_buffer.

The route included in the EnumerationInfo is computed per USB 2.0 §11.14:

  • If this hub is itself reached through a split transaction (e.g. a full-speed hub behind a high-speed hub’s Transaction Translator), the child inherits the parent’s TT address and port, with the device_speed updated to match the attached device. This is correct because the topmost high-speed hub in the chain owns the TT that services the entire subtree below it.
  • Otherwise, if this hub introduces a speed mismatch with the child (HS hub with an LS/FS child, or FS hub with an LS child, where the latter uses the legacy PRE prefix on full-speed buses), a new SplitInfo is constructed pointing at this hub.
  • Otherwise the child is reached directly at its native speed.

Auto Trait Implementations§

§

impl<'d, A, const MAX_PORTS: usize> Freeze for HubHandler<'d, A, MAX_PORTS>

§

impl<'d, A, const MAX_PORTS: usize> !RefUnwindSafe for HubHandler<'d, A, MAX_PORTS>

§

impl<'d, A, const MAX_PORTS: usize> Send for HubHandler<'d, A, MAX_PORTS>
where <A as UsbHostAllocator<'d>>::Pipe<Interrupt, In>: Send, <A as UsbHostAllocator<'d>>::Pipe<Control, InOut>: Send, A: Send,

§

impl<'d, A, const MAX_PORTS: usize> Sync for HubHandler<'d, A, MAX_PORTS>
where <A as UsbHostAllocator<'d>>::Pipe<Interrupt, In>: Sync, <A as UsbHostAllocator<'d>>::Pipe<Control, InOut>: Sync, A: Sync,

§

impl<'d, A, const MAX_PORTS: usize> Unpin for HubHandler<'d, A, MAX_PORTS>
where <A as UsbHostAllocator<'d>>::Pipe<Interrupt, In>: Unpin, <A as UsbHostAllocator<'d>>::Pipe<Control, InOut>: Unpin, A: Unpin,

§

impl<'d, A, const MAX_PORTS: usize> !UnwindSafe for HubHandler<'d, A, MAX_PORTS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.