[poky] Give others users than "root" access to GPIO (or commands)
Arno Steffens
star at gmx.li
Fri Jun 1 04:18:47 PDT 2018
> Gesendet: Mittwoch, 30. Mai 2018 um 12:18 Uhr
> Von: "Richard Purdie" <richard.purdie at linuxfoundation.org>
> An: "Arno Steffens" <star at gmx.li>, ChenQi <Qi.Chen at windriver.com>
> Cc: "pokyyoctoproject.org" <poky at yoctoproject.org>
> Betreff: Re: [poky] Give others users than "root" access to GPIO (or commands)
>
> On Wed, 2018-05-30 at 12:01 +0200, Arno Steffens wrote:
> > Thanks Chen,
> > sounds easy but I get to my surprise a problem with a shared library
> > (cannot open shared object file: No such file or directory) -
> > althought the LD_LIBRARY_PATH is set (/opt/lib) and the file
> > available?
>
> setuid will clear LD_LIBRARY_PATH and other environmental variables for
> security reasons. Try adding an RPATH to the binary directly using
> chrpath or patchelf?
>
> Cheers,
>
> Richard
In case others will be search for that too:
I tried both ways. For solution I (setuid) I could solve the missing lib error with:
add via glibc_%.bbappend:
do_install_append () {
echo "/opt/lib" >> ${D}${sysconfdir}/ld.so.conf
}
(although compiler option -rpath should work too).
With udev rules I created:
KERNEL=="i2c-[0-7]", MODE="0666"
KERNEL=="spi*", MODE="0666"
KERNEL=="gpiochip0", MODE="0666", PROGRAM="/bin/sh -c 'chmod -R 0777 /sys/class/gpio'"
That works find for i2c and spi, but not for GPIO.
After exporting the gpio, the direction and value keep just writeable for the owner.
So even adding GPIO to a group will now help. The only option I found was to execute a longer script exporting all pins and than change permissions. Not really sophisticated.
Thanks
Arno
More information about the poky
mailing list