pub struct UsbBackend { /* private fields */ }
Expand description
The UsbBackend
provides low-level USB access to debugging devices.
Implementations§
Source§impl UsbBackend
impl UsbBackend
Sourcepub fn scan(
usb_vid: u16,
usb_pid: u16,
usb_serial: Option<&str>,
) -> Result<Vec<(Device<GlobalContext>, String)>>
pub fn scan( usb_vid: u16, usb_pid: u16, usb_serial: Option<&str>, ) -> Result<Vec<(Device<GlobalContext>, String)>>
Scan the USB bus for a device matching VID/PID, and optionally also matching a serial number.
Sourcepub fn new(usb_vid: u16, usb_pid: u16, usb_serial: Option<&str>) -> Result<Self>
pub fn new(usb_vid: u16, usb_pid: u16, usb_serial: Option<&str>) -> Result<Self>
Create a new UsbBackend.
pub fn get_vendor_id(&self) -> u16
pub fn get_product_id(&self) -> u16
Sourcepub fn get_serial_number(&self) -> &str
pub fn get_serial_number(&self) -> &str
Gets the usb serial number of the device.
pub fn set_active_configuration(&mut self, config: u8) -> Result<()>
pub fn claim_interface(&mut self, iface: u8) -> Result<()>
pub fn release_interface(&mut self, iface: u8) -> Result<()>
pub fn kernel_driver_active(&self, iface: u8) -> Result<bool>
pub fn detach_kernel_driver(&mut self, iface: u8) -> Result<()>
pub fn attach_kernel_driver(&mut self, iface: u8) -> Result<()>
pub fn active_config_descriptor(&self) -> Result<ConfigDescriptor>
pub fn bus_number(&self) -> u8
pub fn port_numbers(&self) -> Result<Vec<u8>>
pub fn read_string_descriptor_ascii(&self, idx: u8) -> Result<String>
Sourcepub fn write_control(
&self,
request_type: u8,
request: u8,
value: u16,
index: u16,
buf: &[u8],
) -> Result<usize>
pub 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.
Sourcepub fn read_control(
&self,
request_type: u8,
request: u8,
value: u16,
index: u16,
buf: &mut [u8],
) -> Result<usize>
pub 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.
Sourcepub fn read_bulk(&self, endpoint: u8, data: &mut [u8]) -> Result<usize>
pub fn read_bulk(&self, endpoint: u8, data: &mut [u8]) -> Result<usize>
Read bulk data bytes to given USB endpoint.
Auto Trait Implementations§
impl !Freeze for UsbBackend
impl RefUnwindSafe for UsbBackend
impl Send for UsbBackend
impl Sync for UsbBackend
impl Unpin for UsbBackend
impl UnwindSafe for UsbBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more