meg768 / rpi-ws281x

rpi-ws281x
22 stars 26 forks source link

avoid root permissions? #22

Open fquirin opened 2 years ago

fquirin commented 2 years ago

Using the library requires root permissions aka sudo or you will get:

...$ node led-control.js
Can't open /dev/mem: Permission denied
Segmentation fault

My hope was that /dev/gpiomem is enough (see this issue) so I made sure my user has access: sudo usermod -a -G gpio $USER but it doesn't seem to work. Still the same error.

Is it because of PWM? I found this but I'm not sure if it plays any role here.

krisdahl commented 1 year ago

Yeah so I've had same issue. If you want PWM you need root access. But you can use SPI on like port 10 and you won't need root access, just to be part of the gpio group.

fquirin commented 1 year ago

I think that was what I did. It was a bit messy to get it right though if I remember correctly :-|. Since I had 'spi-device' already as dependency I sticked with that in the end.