GPIO Permissions

Hi,

I am using debian-12-base-arm64+roc-rk3328-cc.img on the Renegade board.

Is there a way to allow a regular user to access the GPIO without sudo?

Thank you,
Dave

Check the user and group that udev sets on the /dev/gpiochip0 and /dev/gpiochip1 files. Add the user to the group that the files belong to.

Group is root. I do not want to run as root.
What would go wrong if I changed the group of these files?

crw-------  1 root root    254,   0 Nov 19 23:53 gpiochip0
crw-------  1 root root    254,   1 Nov 19 23:53 gpiochip1
crw-------  1 root root    254,   2 Nov 19 23:53 gpiochip2
crw-------  1 root root    254,   3 Nov 19 23:53 gpiochip3
crw-------  1 root root    254,   4 Nov 19 23:53 gpiochip4
crw-------  1 root root    254,   5 Nov 19 23:53 gpiochip5

First create a gpio group.

sudo addgroup --system gpio

You can add a udev rule: /etc/udev/rules.d/99-gpiochip.rules

SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP:="gpio", MODE:="0660"

This sets the permissions to read/write for user/group.

Then add the process running user to that group.

sudo adduser $USER gpio

You need to logout and log back in or restart the system for the new group permissions to apply.

1 Like

Thank you!!
That worked!