-
-
Notifications
You must be signed in to change notification settings - Fork 75
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This looks great. I left some comments.
src/main.rs
Outdated
let selector: probe_rs::DebugProbeSelector = probe_opt.try_into()?; | ||
probe_rs::Probe::open(selector)? | ||
} else { | ||
probes[0].open()? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you change this to throw an error if there's more than one probe? the error should say something like "more than one probe found; use --probe
to specify which one to use"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea.
README.md
Outdated
@@ -44,6 +44,16 @@ To support multiple devices, or permit overriding default behavior, you may pref | |||
`${PROBE_RUN_CHIP}` environment variable, and set `runner` (or | |||
`CARGO_TARGET_${TARGET_ARCH}_RUNNER`) to `probe-run`. | |||
|
|||
If you have several probes connected, you can specify which one to use adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a note here indicating the syntax for the --probe
flag? or say that the syntax can be found in the output of the -h
command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
Additional question: does the selector accept just the serial number (e.g. |
src/main.rs
Outdated
let probe = probes[0].open()?; | ||
let probe = if let Some(probe_opt) = opts.probe.as_deref() { | ||
let selector: probe_rs::DebugProbeSelector = probe_opt.try_into()?; | ||
probe_rs::Probe::open(selector)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, it seems that if you pass "$VID:$PID" as the selector and there are two connected probes with that VID PID pair then this will pick the "first one" of those two -- calling probe-run
a second time results in a probe-rs error ("probe could not be created"). In that scenario we should throw an error and ask the user to narrow down the selection using the serial number.
Is it possible to use DebugProbeSelector
to filter a list of probes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
I don't think probe-rs provides a way to use a DebugProbeSelector
to filter a list of probes. But it is easy enough to implement.
Updated version now requires that only 1 probe matches the DebugProbeSelector
to continue.
No, in |
README.md
Outdated
@@ -44,6 +44,17 @@ To support multiple devices, or permit overriding default behavior, you may pref | |||
`${PROBE_RUN_CHIP}` environment variable, and set `runner` (or | |||
`CARGO_TARGET_${TARGET_ARCH}_RUNNER`) to `probe-run`. | |||
|
|||
If you have several probes connected, you can specify which one to use adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have several probes connected, you can specify which one to use adding | |
If you have several probes connected, you can specify which one to use by adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
README.md
Outdated
PROBE_RUN_PROBE='1366:0101:123456' cargo run | ||
``` | ||
|
||
To list all connected probes run `probe-run --list-probes`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To list all connected probes run `probe-run --list-probes`. | |
To list all connected probes, run `probe-run --list-probes`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
This provides options similar to cargo-flash to list all connected probes and to specify which one to use: probe-run --list-probes probe-run --probe '1366:0101' --chip nrf52 bin probe-run --probe '1366:0101:123456' --chip nrf52 bin This also alows specifying the probe as en env-var: PROBE_RUN_PROBE='1366:0101:123456' cargo run It fixes knurling-rs#14.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic. Thank you!
This provides options similar to cargo-flash to list all connected probes
and to specify which one to use:
probe-run --list-probes
probe-run --probe '1366:0101' --chip nrf52 bin
probe-run --probe '1366:0101:123456' --chip nrf52 bin
This also alows specifying the probe as en env-var:
PROBE_RUN_PROBE='1366:0101:123456' cargo run
It fixes #14.