>If it would be a FPC specific usage question then it would be a bad idea to
post it to fpc-other.
>However as others have already stated accessing GPIOs on RPi is non
specific to FPC and thus it doesn't need to be on fpc-pascal or even
fpc-devel.
OK, I understand.
I have researched a bit more now given the input I received.
Apparently on a Raspberry Pi there are several defined user groups with
specific permissions on the /dev/xxx device files.
It seems like the user pi is member of a lot of these groups and thus would
not really need root to run a program accessing the hardware.
However, when I look at the unit pigpio.pas I found in the lazarus wiki
following a link in one of the responses I got I see this:
function TIoDriver.MapIo: boolean;
begin
Result := True;
fd := fpopen('/dev/mem', O_RdWr or O_Sync); // Open the master /dev/memory
device
if fd < 0 then
begin
Result := False; // unsuccessful memory mapping
end;
//
end;
Notice that the file used is /dev/mem
I don't know if there exists a user group named mem, but in any case the
user pi is not member of any such group.
Could this be the cause for root to be required?
pi@rpi2-jessie ~ $ groups pi
pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev
spi i2c gpio
I asked a similar question in the Raspberry Pi forum and got a reply telling
me to modify this to become:
fd := fpopen('/dev/gpiomem', O_RdWr or O_Sync);
While writing this the final compile of lazarus just finished (I have
started from scratch using Raspbian Jessie and installed trunk of both fpc
and lazarus from svn).
So now I will soon be able to check this....
Best Regards,
Bo Berglund
_______________________________________________
fpc-other maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other