1

I get this error from the rpi_ws281x library when trying to run as user pi (this is a java wrapper around the library):

16:43:59.060 [main] INFO  com.github.mbelling.ws281x.Ws281xLedStrip - LEDs count: 1, GPIO pin: 18, freq hZ: 800000, DMA: 10, brightness: 255, pwm channel: 0, invert: false, strip type: WS2811_STRIP_GRB, clear on exit: true
16:43:59.142 [main] INFO  com.github.mbelling.ws281x.Ws281xLedStrip - Native library loaded
Can't open /dev/mem: Permission denied
!! Failed to initialize WS2811:
java.lang.RuntimeException: Failed to setup lights driver, result code: WS2811_ERROR_MMAP
    at com.github.mbelling.ws281x.Ws281xLedStrip.init(Ws281xLedStrip.java:234)
    at com.github.mbelling.ws281x.Ws281xLedStrip.<init>(Ws281xLedStrip.java:98)

I already followed all possible steps from here, like setting the permissions of /dev/mem and adding user to group gpio, reboot etc. No success. The problem persists. I cannot run my application as super user, as it would screw up a lot of file access and caches I am writing. I really need to be able to run the WS2811 library as a normal user.

4
  • I'm not sure what you are asking. The library needs root permissions to run.
    – joan
    Jun 18, 2021 at 16:28
  • I am asking for a way to give pi the required permissions, so I can run the process as pi and not super-user
    – 0__
    Jun 19, 2021 at 6:10
  • That becomes a standard permissions problem, i.e. not Pi specific.
    – joan
    Jun 19, 2021 at 7:43
  • That's a Pi specific problem because it is about using a common library for WS2811 LEDs via the GPIO, and requiring the PWM of GPIO 18, which is related to the permissions issue.
    – 0__
    Jun 19, 2021 at 13:14

1 Answer 1

0

There seems no way around it. A solution with added latency is to run a separate process on root to control the GPIO, and communicate to it from a user process, e.g. using OSC commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.