Jump to content

Recommended Posts

Posted

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

 

 

 

 

 

Posted

This is because the "sudo" command apply only to the "echo", not to the redirection of the output.

 

Try the following instead :

sudo su - -c "echo 203 > /sys/class/gpio/export"
Posted

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)

Posted

Thanks it works :) , but is there away to grant user space access so that I can access the gpio's like this from user space:

 

echo 203 > /sys/class/gpio/export

 

 

Posted

Thanks tkasier  :)

 

Your answer was crossing with my reply to martinayotte 

 

But also thanks to martinayotte 

 

Last one - where can I find UART -> ttyXX mappings ? 

Posted
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

 

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

Important Information

Terms of Use - Privacy Policy - Guidelines