pub struct BusHandle<'d, A: UsbHostAllocator<'d>> { /* private fields */ }Expand description
Shareable handle for pipe allocation and device enumeration.
A BusHandle bundles a UsbHostAllocator produced by a
UsbHostController with a reference to the bus-wide
BusState.
BusHandle itself implements UsbHostAllocator by forwarding to
its inner allocator, so it can be passed directly to class driver
constructors.
Implementations§
Source§impl<'d, A: UsbHostAllocator<'d>> BusHandle<'d, A>
impl<'d, A: UsbHostAllocator<'d>> BusHandle<'d, A>
Sourcepub fn free_address(&self, addr: u8)
pub fn free_address(&self, addr: u8)
Release a previously allocated device address.
Also releases its descendants. A concurrent removal may queue the notification and delay release until its callback finishes.
Sourcepub async fn enumerate(
&self,
route: BusRoute,
config_buf: &mut [u8],
) -> Result<(EnumerationInfo, usize), EnumerationError>
pub async fn enumerate( &self, route: BusRoute, config_buf: &mut [u8], ) -> Result<(EnumerationInfo, usize), EnumerationError>
Enumerate a connected device.
Performs the standard enumeration sequence:
- Get device descriptor (first 8 bytes) to learn EP0 max packet size
- SET_ADDRESS to assign a unique address
- Get full device descriptor
- Get configuration descriptor
- SET_CONFIGURATION
route describes how the device is reached on the bus (directly
at its native speed, or via split transactions / legacy PRE
through a hub’s transaction translator).
Enumerations are serialised bus-wide through the
BusState’s enumeration mutex.
§Preconditions
The caller must have placed the device into the default
(address 0) state before calling this method. For a root-port
device that means an upstream bus reset has completed; for a
hub-attached device, the parent hub’s port reset must have
completed and BusRoute::Translated must carry the
appropriate SplitInfo.
Returns the EnumerationInfo for the device and the number of
bytes written to config_buf.
Trait Implementations§
Source§impl<'d, A: UsbHostAllocator<'d>> UsbHostAllocator<'d> for BusHandle<'d, A>
impl<'d, A: UsbHostAllocator<'d>> UsbHostAllocator<'d> for BusHandle<'d, A>
Source§type Pipe<T: Type, D: Direction> = <A as UsbHostAllocator<'d>>::Pipe<T, D>
type Pipe<T: Type, D: Direction> = <A as UsbHostAllocator<'d>>::Pipe<T, D>
Source§fn alloc_pipe<T: Type, D: Direction>(
&self,
addr: u8,
endpoint: &EndpointInfo,
split: Option<SplitInfo>,
) -> Result<Self::Pipe<T, D>, HostError>
fn alloc_pipe<T: Type, D: Direction>( &self, addr: u8, endpoint: &EndpointInfo, split: Option<SplitInfo>, ) -> Result<Self::Pipe<T, D>, HostError>
Source§fn device_removed(&self, _addrs: AddressSet)
fn device_removed(&self, _addrs: AddressSet)
addrs are removed. Read more