rust-embedded/discovery

hidapi error: Failed to open a device with path '/dev/hidraw4': Permission denied

simgar opened this issue · 1 comments

simgar commented

On Ubuntu 22.04.3 LTS, I am using a micro:bit v1 and am here: https://github.com/rust-embedded/discovery/blob/master/microbit/src/03-setup/verify.md

When I ran lsusb | grep -i "NXP ARM mbed", I got
Bus 001 Device 010: ID 0d28:0204 NXP ARM mbed

and when I ran ls -l /dev/bus/usb/001/010, I got
crw-rw-rw-+ 1 root plugdev 189, 9 Jan 2 17:22 /dev/bus/usb/001/010

so I think I did the previous instructions correctly.

From, ~/projects/discovery/microbit/src/03-setup$, I run cargo embed --target thumbv6m-none-eabi and I get

Finished dev [unoptimized + debuginfo] target(s) in 0.01s
  Config default
  Target /home/simon/projects/discovery/microbit/target/thumbv6m-none-eabi/debug/rtt-check
   Error Probe could not be created
         
         Caused by:
             0: hidapi error: Failed to open a device with path '/dev/hidraw4': Permission denied
             1: hidapi error: Failed to open a device with path '/dev/hidraw4': Permission denied

I found this: #490 so I renamed the file to 70-microbit.rules (I'm not sure of the significance of the prefix) and changed the content as described but I got the same errors as shown above.

Update

I bought a micro:bit v2 and tried it on the same machine and it worked okay.
I also took a Raspberry Pi 4, and with a new SD card image (Debian GNU/Linux 12 (bookworm)), installed Rust and followed the instructions up to chapter 3. The micro:bit v2 also worked on the Pi and the original v1 micro:bit also failed, this time with:

Finished dev [unoptimized + debuginfo] target(s) in 7.88s
  Config default
  Targe    Finished dev [unoptimized + debuginfo] target(s) in 7.88s
  Config default
  Target /home/simon/projects/discovery/microbit/target/thumbv6m-none-eabi/debug/rtt-check
   Error Probe could not be created
         
         Caused by:
             0: hidapi error: Failed to open a device with path '/dev/hidraw0': Permission denied
             1: hidapi error: Failed to open a device with path '/dev/hidraw0': Permission denied

Running ls -l /dev/hidraw0
gives:

crw------- 1 root root 242, 0 Jan  9 17:53 /dev/hidraw0

I have a micro:bit v1 only, encountered the same issue. Had to use a more general rule (which should work for all CMSIS-DAP devices) based on probe_rs rules file:

$ cat /etc/udev/rules.d/69-microbit.rules 
# CMSIS-DAP for microbit
ATTRS{product}=="*CMSIS-DAP*", MODE="666", GROUP="plugdev", TAG+="uaccess"