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

windows, cmsisdap: incorrect "Probe was not found" error if wrong driver bound with zadig. #2212

Open
Dirbaio opened this issue Feb 19, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Dirbaio
Copy link
Member

Dirbaio commented Feb 19, 2024

  • Use windows, and a cmsisdap probe (example is the Raspberry Pi Debug Probe)
  • Use zadig, bind the libusb0 driver to it.
  • Try to use probe-rs. You get "probe was not found" errors that make no sense. Full logs

Real issue is

DEBUG nusb::platform::windows_winusb::enumeration: Probing interface `USB\VID_2E8A&PID_000C&MI_00\7&1503623E&0&0000` of composite device                                                                                                                                                                                       
DEBUG nusb::platform::windows_winusb::enumeration: Driver is Some("libusb0"), not usable.                                                                                                                                                                                                                                      

Maybe we can somehow detect this and tell the user to use Zadig again to bind the winusb driver instead.

cc @JomerDev

@Dirbaio Dirbaio added the bug Something isn't working label Feb 19, 2024
@kevinmehall
Copy link

This would be detected by an error returned by claim_interface. probe-rs is currently silently ignoring errors from that call, but by that point you've decided that it's the interface you want, so you should probably display a message if claiming it fails instead of saying "Probe was not found".

// Attempt to claim this interface
match device.claim_interface(interface.interface_number()) {
Ok(handle) => {
tracing::debug!("Opening {:04x}:{:04x} in CMSIS-DAPv2 mode", vid, pid);
return Some(CmsisDapDevice::V2 {
handle,
out_ep: eps[0].address(),
in_ep: eps[1].address(),
swo_ep,
max_packet_size: eps[1].max_packet_size(),
});
}
Err(_) => continue,

kevinmehall/nusb#41 makes the error from claim_interface more specific in this case. ErrorKind::Unsupported roughly maps to "You should use Zadig to bind WinUSB".

Claiming an interface would also fail if another process has it claimed -- ErrorKind::ResourceBusy on Linux and macOS, currently ErrorKind::PermissionDenied on Windows, not sure we can tell it apart from a permissions issue.

@rgrr
Copy link

rgrr commented Mar 11, 2024

Solution could be to not use a probe requiring Zadig. Zadig has TMO too many compatibility issues.

Question: does the most recent picoprobe still require Zadig? If yes, I'ld suggest https://github.com/rgrr/yapicoprobe ;-)

@Dirbaio
Copy link
Member Author

Dirbaio commented Mar 11, 2024

the upstream picoprobe includes the winusb descriptors so it works out of the box on Windows without having to use zadig.

In this particular case, the person who ran into this issue had used zadig anyway for some reason (probably troubleshoot another issue), replacing the default (correct) winusb drivers with something else.

@rgrr
Copy link

rgrr commented Mar 11, 2024

Thanks for clarification.

I saw the keyword "Zadig" which creates immediate rash on my side. Now that I have read the last sentence of the description I understand the issue. I'ld write some kind of configuration FAQ. But perhaps not a bad idea to implement this FAQ in code if the problem is clearly detectable.

@Dirbaio
Copy link
Member Author

Dirbaio commented Mar 11, 2024

exactly. this issue is about "probe-rs says probe not found, but it should say probe found but you installed the wrong driver with zadig, please use zadig again to install winusb"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants