discovery icon indicating copy to clipboard operation
discovery copied to clipboard

hidapi error: Permission denied

Open John-Toohey opened this issue 3 years ago • 6 comments

When I run the following command:

$ cargo embed --features v1 --target thumbv6m-none-eabi

I get:

       Error Probe could not be created

             Caused by:
                 0: hidapi error: Permission denied
                 1: hidapi error: Permission denied

Despite having:

$ cat /etc/udev/rules.d/99-microbit.rules

# CMSIS-DAP for microbit
SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", ATTR{idProduct}=="0204", MODE:="666"

I have rebooted several times and even checked the file permission on my device (/dev/bus/usb/001/010):

$ ls /dev/bus/usb/001/010
crw-rw-rw- 189,9 root  4 Dec 07:17 /dev/bus/usb/001/010

My kernel is 6.0.10 and I run archlinux. Any help would be much apreciated.

John-Toohey avatar Dec 04 '22 07:12 John-Toohey

Not sure if this will fix your issue, but I was facing the same error and fixed it with the following udev rule:

# CMSIS-DAP for microbit
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="0660", TAG+="uaccess"

I also needed to use /etc/udev/rules.d/70-microbit.rules, as recommended by the probe-rs docs.

According to the Arch Wiki:

The modern recommended approach for systemd systems is to use a MODE of 660 to let the group use the device, and then attach a TAG named uaccess.

After editing the file, I ran sudo udevadm control --reload and replugged the micro:bit; at which point I was able to run cargo embed without issue.

sudoBash418 avatar Dec 07 '22 12:12 sudoBash418

Had the exact same problem, solution worked. Thanks a lot!

Vortoman avatar Dec 15 '22 22:12 Vortoman

Nice to see that you found a solution. Could one of you put together a PR adding this to the book?

eldruin avatar Jan 16 '23 06:01 eldruin

Same fix worked on Ubuntu, with a udevadm trigger instead of replugging in. :)

bcpeinhardt avatar Feb 13 '23 21:02 bcpeinhardt

Didn't work for me with a v1, not sure why. On Debian 12. Provided my solution here.

vak-leon avatar Jun 11 '24 16:06 vak-leon

@l-0-l Thanks for that.

Note that we are currently planning to remove Microbit v1 from this guide to reduce confusion. If folks feel strongly that we need to continue to support this board, please comment on https://github.com/rust-embedded/wg/pull/759

BartMassey avatar Jun 12 '24 20:06 BartMassey