Struct RusbDevice

Source
pub struct RusbDevice { /* private fields */ }
Expand description

Represents a device provided by the rusb crate.

Implementations§

Source§

impl RusbDevice

Source

pub fn new( handle: DeviceHandle<Context>, serial_number: Option<String>, timeout: Duration, ) -> Result<Self>

Trait Implementations§

Source§

impl UsbDevice for RusbDevice

Source§

fn get_serial_number(&self) -> Option<&str>

Gets the usb serial number of the device.

Source§

fn get_timeout(&self) -> Duration

Get the default timeout for operations.
Source§

fn get_parent(&self) -> Result<Box<dyn UsbDevice>>

Try to get the parent of this device (or None if root).
Source§

fn get_vendor_id(&self) -> u16

Return the VID of the device.
Source§

fn get_product_id(&self) -> u16

Return the PID of the device.
Source§

fn set_active_configuration(&self, config: u8) -> Result<()>

Set the active configuration.
Source§

fn claim_interface(&self, iface: u8) -> Result<()>

Claim an interface for use with the kernel.
Source§

fn release_interface(&self, iface: u8) -> Result<()>

Release a previously claimed interface to the kernel.
Source§

fn set_alternate_setting(&self, iface: u8, setting: u8) -> Result<()>

Set an interface alternate setting.
Source§

fn kernel_driver_active(&self, iface: u8) -> Result<bool>

Check whether a kernel driver currentl controls the device.
Source§

fn detach_kernel_driver(&self, iface: u8) -> Result<()>

Detach the kernel driver from the device.
Source§

fn attach_kernel_driver(&self, iface: u8) -> Result<()>

Attach the kernel driver to the device.
Source§

fn device_descriptor(&self) -> Device<'_>

Return the device’s descriptor.
Source§

fn active_configuration(&self) -> Result<Configuration<'_>>

Return the currently active configuration’s descriptor.
Source§

fn bus_number(&self) -> u8

Return the device’s bus number.
Source§

fn address(&self) -> u8

Return the device’s address.
Source§

fn port_numbers(&self) -> Result<Vec<u8>>

Return the sequence of port numbers from the root down to the device.
Source§

fn read_string_descriptor_ascii(&self, idx: u8) -> Result<String>

Return a string descriptor in ASCII.
Source§

fn reset(&self) -> Result<()>

Reset the device. Read more
Source§

fn write_control_timeout( &self, request_type: u8, request: u8, value: u16, index: u16, buf: &[u8], timeout: Duration, ) -> Result<usize>

Issue a USB control request with optional host-to-device data.
Source§

fn read_control_timeout( &self, request_type: u8, request: u8, value: u16, index: u16, buf: &mut [u8], timeout: Duration, ) -> Result<usize>

Issue a USB control request with optional device-to-host data.
Source§

fn read_bulk_timeout( &self, endpoint: u8, data: &mut [u8], timeout: Duration, ) -> Result<usize>

Read bulk data bytes to given USB endpoint.
Source§

fn write_bulk_timeout( &self, endpoint: u8, data: &[u8], timeout: Duration, ) -> Result<usize>

Write bulk data bytes to given USB endpoint.
Source§

fn write_control( &self, request_type: u8, request: u8, value: u16, index: u16, buf: &[u8], ) -> Result<usize>

Issue a USB control request with optional host-to-device data. Read more
Source§

fn read_control( &self, request_type: u8, request: u8, value: u16, index: u16, buf: &mut [u8], ) -> Result<usize>

Issue a USB control request with optional device-to-host data. Read more
Source§

fn read_bulk(&self, endpoint: u8, data: &mut [u8]) -> Result<usize>

Read bulk data bytes to given USB endpoint. Read more
Source§

fn write_bulk(&self, endpoint: u8, data: &[u8]) -> Result<usize>

Write bulk data bytes to given USB endpoint. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V