Skip to main content

open_probe

Function open_probe 

Source
pub fn open_probe(usbdev: &UsbDev, driver: Driver) -> Result<Probe, String>
Expand description

Opens usbdev with driver, as a probe-rs [Probe].

Nothing is attached yet: the tag is not reset until the caller attaches.

For Driver::Stock the base is found among the ST-LINKs by USB vendor and product ID and then by serial number. If the serial does not match (or usbdev has none) and there is exactly one candidate, that one is used.

The Stock path enumerates and opens through [StLinkFactory] only, never probe-rs’s Lister. Lister also enumerates CMSIS-DAP probes over hidapi, and on macOS hidapi binds its IOHIDManager to the first thread that used it; a second programming run from another worker thread (as tagprogram-rs does) then aborted the whole process. Going back to Lister for convenience brings that crash back (fixed in commit 36c06ce2).

§Errors

The probe driver’s message if the base cannot be opened, or "Cannot tell this base from the other ST-LINKs" when several ST-LINKs are connected and none matches usbdev’s serial number.