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

Bo Berglund bo.berglund at gmail.com
Thu Oct 8 21:05:37 CEST 2015


On Thu, 08 Oct 2015 13:15:10 +0000, Mark Morgan Lloyd
<markMLl.fpc-pascal at telemetry.co.uk> wrote:

>> 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".
Did you mean this page:
http://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#5._PiGpio_Low-level_native_pascal_unit_.28GPIO_control_instead_of_wiringPi_c_library.29

It contains a unit PiGpio for the Broadcom chip on the original Pi.
Is this some the fpc wrapper that handles what has been described in
this thread so an fpc program can actually read and write the GPIO
pins?

It seems easy enough to use were it not for the discussion here
talking about modifying user permissions on Linux to make the program
run...

This is what I see in the gpio dir:
root at rpi2b-wheezy:/sys/class/gpio# ls -la
total 0
drwxrwx---  2 root gpio    0 Jan  1  1970 .
drwxr-xr-x 44 root root    0 Oct  8 20:38 ..
-rwxrwx---  1 root gpio 4096 Jan  1  1970 export
lrwxrwxrwx  1 root gpio    0 Jan  1  1970 gpiochip0 ->
../../devices/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx---  1 root gpio 4096 Jan  1  1970 unexport


-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list