Skip to content

Move more Core functions to ProbeCore#700

Merged
mkeeter merged 7 commits into
masterfrom
mkeeter/remove-more-core-functions
Jun 17, 2026
Merged

Move more Core functions to ProbeCore#700
mkeeter merged 7 commits into
masterfrom
mkeeter/remove-more-core-functions

Conversation

@mkeeter

@mkeeter mkeeter commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

vid_pid, step, and write_reg are only available on ProbeCore. This PR removes them from the Core trait, adjusting signatures where necessary to force the concrete type.

This comment was marked as resolved.

@mkeeter

mkeeter commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I had to do a bit of extra wrangling to get the probeless build working; it now skips subcommands which are probe-only, both in the Cargo.toml (optional dependencies) and in codegen (ugly hacks).

Comment thread humility-bin/build.rs Outdated
Comment thread humility-bin/build.rs Outdated
@labbott

labbott commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

I had to do a bit of extra wrangling to get the probeless build working; it now skips subcommands which are probe-only, both in the Cargo.toml (optional dependencies) and in codegen (ugly hacks).

I had hoped to be able to drop this after the probe-rs update but so long as we need to keep CMSIS DAP v1 around we will still need these hacks :(

@mkeeter mkeeter force-pushed the mkeeter/remove-more-core-functions branch from 547b59b to a8aa5cc Compare June 17, 2026 15:06

@labbott labbott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor fixup but LGTM otherwise

Comment thread humility-probes-core/src/probe_rs.rs Outdated
Comment on lines +344 to +346
pub fn vid_pid(&self) -> Option<(u16, u16)> {
Some((self.vendor_id, self.product_id))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop the Option here now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, done!

@labbott

labbott commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I also think we can move info to ProbeCore but that seems like a follow up task

@hawkw hawkw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me overall, with some minor nits

Comment thread humility-cli/src/lib.rs Outdated
#[cfg(not(feature = "probes"))]
{
Err(anyhow!(
"probes feature is missing; ip address or dump is required"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, maybe:

Suggested change
"probes feature is missing; ip address or dump is required"
"humility was compiled without the \"probes\" feature; \
an IP address or dump is required"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, done

Comment thread humility-cli/src/lib.rs
Comment on lines +191 to +193
Err(anyhow!(
"probes feature is missing; ip address is required"
))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turbo nit: maybe:

Suggested change
Err(anyhow!(
"probes feature is missing; ip address is required"
))
Err(anyhow!(
"humility was compiled without the \"probes\" feature; \
an IP address is required"
))

or something? i think "probes feature is missing" is a little bit unclear for the user who may not be aware that this is specifically referring to a compile-time feature flag rather than some CLI arg you forgot to provide or something...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done

Comment thread humility-probes-core/src/probe_rs.rs Outdated
Comment on lines +344 to +346
pub fn vid_pid(&self) -> Option<(u16, u16)> {
Some((self.vendor_id, self.product_id))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe a suggestion better saved for a follow-up change, since I'm sure it will break some stuff, but I really wish that this was

pub struct VidPid {
    pub vid: u16,
    pub pid: u16,
}

rather than a tuple, so it's impossible to get them backwards (since we've had at least one bug where we did that).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is easy enough; I also added a Display implementation that prints vid:pid with the expected formatting.

@mkeeter mkeeter force-pushed the mkeeter/remove-more-core-functions branch from a8aa5cc to 26cd75e Compare June 17, 2026 17:39
@mkeeter

mkeeter commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

I also think we can move info to ProbeCore but that seems like a follow up task

That was easy enough to do that I just did it here as well

@mkeeter mkeeter force-pushed the mkeeter/remove-more-core-functions branch from e699fc9 to 242ae51 Compare June 17, 2026 18:20
@mkeeter mkeeter force-pushed the mkeeter/remove-more-core-functions branch from 242ae51 to 6beb7b6 Compare June 17, 2026 18:23
@mkeeter mkeeter merged commit a5d7b71 into master Jun 17, 2026
13 checks passed
@mkeeter mkeeter deleted the mkeeter/remove-more-core-functions branch June 17, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants