[fpc-pascal] Access GPIO pins on RPi2 without root?

Henry Vermaak henry.vermaak at gmail.com
Thu Oct 8 14:08:15 CEST 2015


On Wed, Oct 07, 2015 at 01:09:58PM +0200, Bo Berglund wrote:
> On Wed, 07 Oct 2015 10:05:03 +0200, Jonas Maebe
> <jonas.maebe at elis.ugent.be> wrote:
> >Bo Berglund wrote on Wed, 07 Oct 2015:
> >
> >> How can one control the GPIO outputs on a Raspberry Pi2 without
> >> needing the program to run as root? I am using Raspbian Wheezy and I
> >> need to add two relays controls to my program.
> >
> >This really has nothing to do with either FPC or Pascal programming in  
> >general. Please ask such questions on the fpc-other list in the future.
> >
> I think that it really does because there must be some interface
> between the FPC system and the underlying operating system managing
> the hardware.

You access the GPIOs via the kernel's sysfs interface.  The files are
all under /sys/class/gpio.  I'd be pretty amazed if your distro doesn't
already have a udev rule to set a certain group for those files.  You
probably just have to add your user to that group.

Henry



More information about the fpc-pascal mailing list