adafruit / Adafruit_CircuitPython_ADS1x15

CircuitPython drivers for the ADS1x15 series of ADCs.
MIT License
133 stars 58 forks source link

Permission denied #94

Closed jon-daemon closed 7 months ago

jon-daemon commented 8 months ago

I'm trying to install it on an Orange Pi Zero with Armbian. If I run the example code with sudo python3 example.py it works. If install it without sudo and run the example, i get:

PermissionError: [Errno 13] Permission denied

If I install it in a virtual environment I get:

AttributeError: type object 'Chip' has no attribute 'OPEN_BY_NAME'

Why is this happening? The thing is I want to install mqtt-io in a virtual environment which depends on that.

jon-daemon commented 7 months ago

It fixed after changing ownership and permissions of /dev/gpiochip0 and /dev/gpiochip0 to root:gpio and 664. My user is ini gpio group. I added in /etc/udev/rules.d/99-gpio.rules this rule.

KERNEL=="gpiochip*", SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /dev/gpiochip0 /dev/gpiochip1 ; chmod 664 /dev/gpiochip0 /dev/gpiochip1'"