[fpc-pascal] Access GPIO pins on RPi2 without root?
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Fri Oct 9 00:01:49 CEST 2015
Bo Berglund wrote:
> On Thu, 08 Oct 2015 19:48:54 +0000, Mark Morgan Lloyd
> <markMLl.fpc-pascal at telemetry.co.uk> wrote:
>
>> Do not, under any circumstances, try to fiddle with the permission of
>> those files/directories. Instead, add the gpio group to your normal user
>> (as I have already said).
>>
>> Jonas has already asked us to discuss this elsewhere, i.e. either the
>> fpc-other or lazarus-other mailing list, and I really do not want to
>> upset the list managers by going into basic unix management or into
>> things which are specific to managing the RPi.
>>
>> Having said that, by analogy if you want to drive one of the serial
>> ports on a Linux system you usually end up adding the dialout group to
>> your normal user ID. If you aren't prepared to discuss this in one of
>> the more general MLs, then I suggest researching that and then extending
>> what you learn to adding the gpio group to your normal user.
>
> Sorry for causing a problem here...
> The lists you refer to are not present in the Gmane newsserver as a
> newsgroup so I cannot access it.
I suggest setting up a direct subscription using the instructions given
at http://www.freepascal.org/maillist.var Things like Gmane are really
only useful as long-term archives.
> I have asked about this on the Pi forum instead, but I fear noone
> (almost) over there use free-pascal so I have no high hopes.
>
> The user pi seems to be in the required group so I take it there is no
> need to sudo any execution of the program for user pi?
> pi at rpi2b-wheezy ~ $ groups pi
> pi : pi adm dialout cdrom sudo audio video plugdev games users netdev
> input spi i2c gpio
Or add the gpio group to your normal userid. However the "right" way of
doing this usually relies on a system-specific user management program
(the "wrong" way, which most people use in practice, is to edit
/etc/group and /etc/gshadow).
> I will try to locate an updated pigpio.pas file by asking in the
> Lazarus forum instead.
I would strongly suggest going through /sys/class/gpio first, since you
can exercise it using echo and there are fewer things to get wrong.
--
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