pub struct Hub<'d, 'a, C: HostController> { /* private fields */ }Expand description
An enumerated hub.
Implementations§
Source§impl<'d, 'a, C: HostController> Hub<'d, 'a, C>
impl<'d, 'a, C: HostController> Hub<'d, 'a, C>
Sourcepub fn open(device: &'a Device<'d, C>) -> HostResult<Self>
pub fn open(device: &'a Device<'d, C>) -> HostResult<Self>
Select the hub’s configuration and read its class descriptor.
The hub keeps answering control requests either way, but its
downstream ports cannot be powered before SET_CONFIGURATION.
Sourcepub fn descriptor(&self) -> &HubDescriptor
pub fn descriptor(&self) -> &HubDescriptor
The class descriptor read in open.
Sourcepub fn power_ports(&self) -> HostResult<()>
pub fn power_ports(&self) -> HostResult<()>
Power every downstream port that is not powered yet and wait for
bPwrOn2PwrGood to elapse.
A ganged hub powers all ports from one switch, so the first request already powers the rest; asking port by port is harmless and keeps the driver independent of the switching mode.
Sourcepub fn port_status(&self, port: u8) -> HostResult<HubPortStatus>
pub fn port_status(&self, port: u8) -> HostResult<HubPortStatus>
Read wPortStatus and wPortChange of port.
Sourcepub fn clear_port_change(&self, port: u8, change: u16) -> HostResult<()>
pub fn clear_port_change(&self, port: u8, change: u16) -> HostResult<()>
Clear every change bit in change.
The change bits of wPortChange map one to one onto the C_PORT_*
feature selectors, which is why the selector is the bit position plus
the selector of C_PORT_CONNECTION.
Sourcepub fn wait_for_connection(
&self,
port: u8,
timeout_ms: u32,
) -> HostResult<HubPortStatus>
pub fn wait_for_connection( &self, port: u8, timeout_ms: u32, ) -> HostResult<HubPortStatus>
Wait until a device is attached to port.
Sourcepub fn reset_port(&self, port: u8) -> HostResult<Speed>
pub fn reset_port(&self, port: u8) -> HostResult<Speed>
Reset port and report the speed of the device behind it.
This is what the root port’s reset_port does for the hub itself: the
device answers at address zero afterwards and has to be enumerated with
enumerate_child.
Sourcepub fn enumerate_child(
&self,
port: u8,
address: DeviceAddress,
) -> HostResult<Device<'d, C>>
pub fn enumerate_child( &self, port: u8, address: DeviceAddress, ) -> HostResult<Device<'d, C>>
Enumerate the device attached to port at address.
The port must have been reset with reset_port
first.