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

Cant get strandtest.py to run without root #270

Closed
Quad14 opened this issue Feb 7, 2018 · 7 comments
Closed

Cant get strandtest.py to run without root #270

Quad14 opened this issue Feb 7, 2018 · 7 comments

Comments

@Quad14
Copy link

Quad14 commented Feb 7, 2018

Hello,
I am trying to run strandtest.py without root access as a test for a latter script. I have enable spi on the rpi 3 and set the core_freq=250. I also changed LED_PIN = 10.
I receive the following error:
python strandtest.py
Can't open /dev/mem: Permission denied
Traceback (most recent call last):
File "strandtest.py", line 102, in
strip.begin()
File "build/bdist.linux-armv7l/egg/neopixel.py", line 106, in begin
RuntimeError: ws2811_init failed with code -13 (Unable to initialize SPI)

Is there something I need to change in strandtest.py?
Thanks!

@ErikBorra
Copy link

See #257

@Quad14
Copy link
Author

Quad14 commented Feb 12, 2018

I followed (to the best of my understanding) those instructions but was still not able to get the strandtest.py to work on spi without sudo access. I should be able to use the neopixel.py ported library correct?

@Gadgetoid
Copy link
Collaborator

Your error appears to be with enabling SPI, rather than the normal issue with root access required for /dev/mem.

Are you still having issues?

What do you see if you: lsmod | grep spi?

@melzoghbi
Copy link

I am having the same issue on the latest Raspbian as well. i want to be able to run this without sudo.
Yes i am a member of gpio group as well.

In my case:
sudo python strandtest.py --> WORKS

python strandtest.py --> THIS DOESN'T WORK

Here is the error i get:
RuntimeError: ws2811_init failed with code -5 (mmap() failed)

@Gadgetoid : This is the output when i run lsmod command:

image

Thoughts?

@PandorasFox
Copy link
Contributor

make sure you set the spidev.bufsiz=32768 in /boot/cmdline.txt. I recall having a similar error until I did that, when I was testing stuff.

I haven't updated my pi in a while so it's possible something broke on the latest releases, though.

@Gadgetoid
Copy link
Collaborator

@melzoghbi unless you've modified standtest.py to use an SPI-enabled pin, then the mmap() error is an expected outcome. You must run with sudo to supply privileged hardware access.

@Gadgetoid
Copy link
Collaborator

Have duplicated this for posterity over on the Python bindings: rpi-ws281x/rpi-ws281x-python#9

For all future issues/requests relating to Python please see: https://github.com/rpi-ws281x/rpi-ws281x-python/issues/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants