Page 1 of 1

WiringPi/Pi4J without sudo in Spring Boot

Posted: Sun Jan 14, 2018 8:26 am
by megamarky
Hi,

there's a Beta version http://gigabrain.io/twoplayer.html of a two player game that runs with Spring Boot and Pi4J. To get the GPIO write access the boot app will have to be run with GPIO write rights.

Currently the install script launches the java app with sudo command, and the app checks rights to /dev/mem and this needs to be changed not to require the sudo.

The Pi4J 1.2 SNAPSHOT is currently used. There was a post about the http://wiringpi.com/wiringpi-update-to-2-29/

Code: Select all

export WIRINGPI_GPIOMEM=1
Should only this environment variable be enough for this setup? Has anyone made a Pi4J setup to use the /dev/gpiomem access with wiringpi?

Re: WiringPi/Pi4J without sudo in Spring Boot

Posted: Sun Jan 14, 2018 10:14 am
by DougieLawson

Re: WiringPi/Pi4J without sudo in Spring Boot

Posted: Sun Jan 14, 2018 11:32 am
by megamarky
Thank you, I did not realize that this was the same property as the pi4j.linking. I will change it to use the property

Code: Select all

java -Dpi4j.linking=dynamic 

Re: WiringPi/Pi4J without sudo in Spring Boot

Posted: Mon Jan 15, 2018 2:27 pm
by megamarky
There still seems to be issue using the PWM write functions without sudo.

https://github.com/raspberrypi/linux/issues/1983

https://github.com/Pi4J/pi4j/issues/352

Looks like there is a new RaspberryPi kernel version coming that has the PWM usage without sudo.