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

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Oct 8 15:15:10 CEST 2015


Henry Vermaak wrote:
> 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.

Yes, it's the gpio group. I worked through the first couple of steps as 
described on the Lazarus wiki page manually (i.e. using echo from the 
command line), so can confirm that it's broadly accurate as of Raspbian 
"Wheezy".

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list