Is it possible to access GPIO without sudo?

In my snapcraft.yml I use:

...
plugs: [gpio]
....

When I run my app however, I get this error: open /sys/class/gpio/export: permission denied
I suspect that the GPIO interface is not available to my snap in that location. Where do we get access to them?

EDIT: After lots of digging and searching, it seems that the path is correct. But my app doesn’t have permission. If I run my script with sudo then it works as expected, except that it now looks for config files in the root user dir. Is it possible to have access to GPIO without needing to use sudo?

1 Like