All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arno Steffens" <star@gmx.li>
To: "Richard Purdie" <richard.purdie@linuxfoundation.org>
Cc: "pokyyoctoproject.org" <poky@yoctoproject.org>
Subject: Re: Give others users than "root" access to GPIO (or commands)
Date: Fri, 1 Jun 2018 13:18:47 +0200	[thread overview]
Message-ID: <trinity-c9ee44a9-0324-42fe-8678-cf1e7ffaf238-1527851927233@3c-app-gmx-bs34> (raw)
In-Reply-To: <1527675512.16911.130.camel@linuxfoundation.org>



> Gesendet: Mittwoch, 30. Mai 2018 um 12:18 Uhr
> Von: "Richard Purdie" <richard.purdie@linuxfoundation.org>
> An: "Arno Steffens" <star@gmx.li>, ChenQi <Qi.Chen@windriver.com>
> Cc: "pokyyoctoproject.org" <poky@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



  reply	other threads:[~2018-06-01 11:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 10:41 Give others users than "root" access to GPIO (or commands) Arno Steffens
2018-05-30  6:03 ` ChenQi
2018-05-30 10:01   ` Arno Steffens
2018-05-30 10:18     ` Richard Purdie
2018-06-01 11:18       ` Arno Steffens [this message]
2018-05-30 10:36     ` star
2018-05-30  7:21 ` Richard Purdie
2018-05-30 10:20   ` Arno Steffens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-c9ee44a9-0324-42fe-8678-cf1e7ffaf238-1527851927233@3c-app-gmx-bs34 \
    --to=star@gmx.li \
    --cc=poky@yoctoproject.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.