-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The big sudo challenge: how can we fix the need to run PiGpio provider applications as sudo? #212
Comments
This is not just a documentation issue. This is a real deal-breaker and makes using Pi4J utterly unusable in any program that requires network listeners or similar permission sensitive services. Node and python both have ways of doing GPIO and SPI without sudo privileges and appear to do so without yet another daemon and yet another slow socket interface. Are there any supported alternatives to pigpio please? |
The Accessing GPIO via the Linux (user) file system drivers does add some latency but likely not as much as a socket daemon. I'm not sure if PWM functions or other supported I/O capabilities have been exposed via the Linux FS yet or not. Additional details when this was implemented in the previous generation of Pi4J are included here: REF: #117 |
Hi @savageautomate, would be great if you could get me started on this LinuxFS or if we could work together on it... |
An interesting (and faster) alternative is to consider using |
@hackerjimbo sounds promising :-) |
The GPIO library used by the v1 version used it. |
Essentially it's like |
So why did later versions switch to things like Wiring and now pigpio, which themselves both seem to have very limited / sporadic support? |
Because the original one wasn't maintained. |
indeed WiringPi got deprecated in 2019. That's why Pi4J V2 switched to PiGpio. These native libraries are the "gateway" between Java and the GPIOs. |
Problem seems to be that these gateways all to often become unhinged. pigpio not only requires root privileges but also seems to block other programs from accessing unrelated gpio pins and does not release that control even when you terminate the daemon. |
I have been working on the LinuxFS implementation of a GPIO provider based on the older Linux Filesystem GPIO driver via the You can see this changes and build from this branch if you would like to test them out. Here are some basic examples I used to test with for Linux FS Digital Input, Digital Output, and PWM: Note, I did not get PWM working on my system without |
Yes, that would be something we could look into. However, to start with I'm trying to target the generic Linux kernel defined GPIO APIs so that the implementation may potentially be useful for other SoCs in the future. If we implement any RaspberryPi specific code, we would do that in the RaspberryPi I/O providers (which are currently just stubs and not implemented.). Currently, I'm prototyping the native code to allow Pi4J to use the newer |
We now have a new gpiod implementation, and this doesn't require sudo anymore. So this issue is resolved, check out the new provider: https://www.pi4j.com/documentation/providers/gpiod/ |
Thank you a lot for this release! |
The pigpio provider still requires sudo https://www.pi4j.com/documentation/providers/. |
As the native PiGpio integration requires sudo-privileges, a lot of users have problems or don't know if this requirement although it is mentioned in the documentation.
Relateded issues
The text was updated successfully, but these errors were encountered: