Jump to content

GPIO access from user space


Mabzy

Recommended Posts

Hi

 

Can any one tell me how to access the GPIO from user space, I have tried this:

 

 

sudo echo 203 > /sys/class/gpio/export

 

But get this result :(

 

-bash: /sys/class/gpio/export: Permission denied

 

It's of course some thing really simple, but I haven't been able to find any thing which can lead in the right direction.

 

I have tried adding user account to the /etc/sudoers

 

By inserting this:

 

 

# See sudoers(5) for more information on "#include" directives:

 

#includedir /etc/sudoers.d

 

mabzy ALL=(ALL) NOPASSWD: ALL

 

 

 

 

 

Link to comment
Share on other sites

Please compare with http://forum.armbian.com/index.php/topic/1851-rfc-make-armbian-more-iot-friendly/

 

Might be worth a try adding a group gpio, adding your user to this group and putting

chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio

into /etc/rc.local prior to "exit 0". Adding group gpio and a user to it should be possible this way:

sudo su -
addgroup gpio
usermod -aG gpio ${SUDO_USER}

(log out and in afterwards)

Link to comment
Share on other sites

On 8/22/2016 at 1:20 PM, tkaiser said:

Please compare with http://forum.armbian.com/index.php/topic/1851-rfc-make-armbian-more-iot-friendly/

 

Might be worth a try adding a group gpio, adding your user to this group and putting


chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio

into /etc/rc.local prior to "exit 0". Adding group gpio and a user to it should be possible this way:


sudo su -
addgroup gpio
usermod -aG gpio ${SUDO_USER}

(log out and in afterwards)

I also had to run:

 

chown -R root:gpio /sys/devices/platform/sunxi-pinctrl/gpio
chmod -R 770 /sys/devices/platform/sunxi-pinctrl/gpio

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines