pub struct OpenUsbDevice { /* private fields */ }
Expand description
An opened USB device.
Dropping this causes the USB device to be closed.
Implementations§
Source§impl OpenUsbDevice
impl OpenUsbDevice
Sourcepub async fn close(self) -> Result<()>
pub async fn close(self) -> Result<()>
Releases all open interfaces and ends the device session.
It is not necessary to call this method, since dropping OpenUsbDevice will also close the USB device.
Sourcepub async fn select_configuration(&self, configuration: u8) -> Result<()>
pub async fn select_configuration(&self, configuration: u8) -> Result<()>
Selects the USB device configuration with the specified index.
Sourcepub async fn claim_interface(&self, interface: u8) -> Result<()>
pub async fn claim_interface(&self, interface: u8) -> Result<()>
Claim specified interface for exclusive access.
Sourcepub async fn release_interface(&self, interface: u8) -> Result<()>
pub async fn release_interface(&self, interface: u8) -> Result<()>
Release specified interface from exclusive access.
Sourcepub async fn select_alternate_interface(
&self,
interface: u8,
alternate: u8,
) -> Result<()>
pub async fn select_alternate_interface( &self, interface: u8, alternate: u8, ) -> Result<()>
Selects the alternate setting with the specified index for an interface.
Sourcepub async fn clear_halt(
&self,
direction: UsbDirection,
endpoint: u8,
) -> Result<()>
pub async fn clear_halt( &self, direction: UsbDirection, endpoint: u8, ) -> Result<()>
Clears a halt condition.
A halt condition is when a data transfer to or from the device has a status of ‘stall’, which requires the web page (the host system, in USB terminology) to clear that condition.
Sourcepub async fn control_transfer_in(
&self,
control_request: &UsbControlRequest,
len: u16,
) -> Result<Vec<u8>>
pub async fn control_transfer_in( &self, control_request: &UsbControlRequest, len: u16, ) -> Result<Vec<u8>>
Perform a control transfer from device to host.
Sourcepub async fn control_transfer_out(
&self,
control_request: &UsbControlRequest,
data: &[u8],
) -> Result<u32>
pub async fn control_transfer_out( &self, control_request: &UsbControlRequest, data: &[u8], ) -> Result<u32>
Perform a control transfer from host to device.
Sourcepub async fn isochronous_transfer_in(
&self,
endpoint: u8,
packet_lens: impl IntoIterator<Item = u32>,
) -> Result<Vec<Result<Vec<u8>>>>
pub async fn isochronous_transfer_in( &self, endpoint: u8, packet_lens: impl IntoIterator<Item = u32>, ) -> Result<Vec<Result<Vec<u8>>>>
Transmits time sensitive information from the device.
Sourcepub async fn isochronous_transfer_out(
&self,
endpoint: u8,
packets: impl IntoIterator<Item = &[u8]>,
) -> Result<Vec<Result<u32>>>
pub async fn isochronous_transfer_out( &self, endpoint: u8, packets: impl IntoIterator<Item = &[u8]>, ) -> Result<Vec<Result<u32>>>
Transmits time sensitive information to the device.
Returns the number of bytes sent of each packet.