Trait punt::UsbContext

source ·
pub trait UsbContext: UsbContext {
    // Provided methods
    fn find_targets(&self) -> Result<Vec<Target<Self>>> { ... }
    fn pick_target(&self, serial: Option<&str>) -> Result<Target<Self>> { ... }
}
Expand description

Base trait for a USB context.

Provided Methods§

source

fn find_targets(&self) -> Result<Vec<Target<Self>>>

Returns information about all connected targets in bootloader mode. USB devices not in bootloader mode cannot be detected, since their protocol for entering bootloader mode is not specified.

It returns Error::IoError on USB errors during device enumeration.

source

fn pick_target(&self, serial: Option<&str>) -> Result<Target<Self>>

Returns one target if either

  • A serial number is supplied which matches one of the connected targets’ serial numbers or
  • Only one target is connected and either no serial number is supplied or the serial number matches.

It can return the following errors:

Just like with find_targets, only targets in bootloader mode are considered.

Implementors§