Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offer some advice if we fail to open the requested probe #504

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

iximeow
Copy link
Member

@iximeow iximeow commented Aug 15, 2024

earlier this evening i was somewhat perplexed by

$ humility -t sidecar sensors
humility sensors failed: Probe could not be created

Caused by:
    Probe was not found.

but the probe i wanted definitely was connected to the system.

eventually i realized that probe_rs tries to read the serial number, fails (because i was not root), believes the device must simply not be the one i wanted (but it was!!), and reports ProbeCreationError::NotFound.

so, in the specific case that you're opening a probe by vid:pid:serial and the error is NotFound, hint that we might not have been able to look quite as fully as the user might have hoped.

i'd typically check if libc::getuid() == 0 before suggesting "try as root", but i saw some #[cfg] that suggest Humility is expected to work on Windows (neat!) and i'm not sure if that applies so generally. and on some systems users could be in the usb group so you might not need root to get a serial number anyway. so i decided to leave it at "if not root already..." in the hopes that whoever reads it understands the right meaning in their context.

with this change, the same command errors somewhat more helpfully:

$ ./humility -t sidecar sensors
humility sensors failed: Could not find probe 0483:374e:002900184741500520383733. 

Because a serial number is present, this may be due to not running humility with permission to read USB device serial numbers; if not root already, run again as root?

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you!

humility-core/src/core.rs Outdated Show resolved Hide resolved
@iximeow iximeow merged commit 0d33199 into master Aug 15, 2024
11 checks passed
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.

2 participants