GPIO ports: create group with permission to write

Ask questions about Arch Linux ARM. Please search before making a new topic.

GPIO ports: create group with permission to write

Postby jang0 » Mon Aug 19, 2019 11:11 pm

I'm using archlinux ARM to create embedded linux for machine control, the system requires that certain user that is not root user and can't use sudo permissions, write over GPIO ports. I know that it can be achieve using Raspbian: adding that user to GPIO group that have the needen permissions. The problem is that archlinux have not that group, and GPIO pins can't be transform unless you are root. How can I create that group?
jang0
 
Posts: 2
Joined: Mon Aug 19, 2019 10:33 pm

Re: GPIO ports: create group with permission to write

Postby TheSaint » Tue Aug 20, 2019 6:19 am

Have you visit the author site?
But is better you find the files on the github.
On the github you may find the suitable language you will prefer to use. I prefered the gpio, which has the ability to change the user accessibility on-the-fly.
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: GPIO ports: create group with permission to write

Postby jang0 » Tue Aug 20, 2019 5:19 pm

I'm using as hardware the ODROID-XU4 and installed archlinux ARMv7. Accessing root I've changed the state of GPIO ports with shell commands and python-periphery library, the problem arise trying to execute the code as other user; the python-periphery outputs are the following:

$this->bbcode_second_pass_code('', 'periphery.gpio.GPIOError: [Errno 13] Setting GPIO direction: Permission denied')
My grafical user interface requires that the code execute without sudo permissions, to create the GPIO group I've tried writing udev rules that suggest those authors arch udev rule and others Raspbian udev rule but get the same error.
jang0
 
Posts: 2
Joined: Mon Aug 19, 2019 10:33 pm

Re: GPIO ports: create group with permission to write

Postby TheSaint » Wed Aug 21, 2019 7:45 am

Sorry my friend, we are on the same boat, no luck to get access to the GPIO as user.
You may try to add an udev rule
$this->bbcode_second_pass_code('', '# To allow additional features like edge detection
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
'"')
Then you should add your user to the gpio group
$this->bbcode_second_pass_code('', '
sudo groupadd gpio ### optional if you don't have such group
sudo gpasswd -a <your_user_name> gpio')
Anyways, this doesn't solve the problem, I still facing permission blockage as normal use, including python-periphery
The only feasible approach it might be to use a daemon which will serve your commands to the GPIO. But you need to have some python experience and you have to rearrange the source to adjust to your goals.

For my own purposes I did get through this phase, because I need to know how it would interface with the home-assistant framework.
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am


Return to User Questions

Who is online

Users browsing this forum: Google [Bot] and 10 guests