Hi there,
I would like to use wiringPi for my lightslider plugin (dim a led-lightstrip for the printbed via a slider in the control tab).
Since the software pwm in the RPi-GPIO library did not produce a stable pwm signal (resulting in a visible flickering) I took a look into wiringPi, which can use the hardware pwm of the RPi.
A first test python script utilizing wiringPi proved that the hw pwm yields much better results.
But since wiringpi modifys the gpio it needs elevated privileges, thus the script needs to be called with sudo.
I tried to transfer the wiringpi commands into the plugin and see if there would be anything in the log files asking for elevated permissions or something(https://github.com/cutnicace/octoprint_lightintensityslider/tree/master/lightslider). But I did not even get far, since octoprint did not get past a certain point. There is no error message or stacktrace in the log, it seems to just exit. My guess (at the moment my only option since I failed to setup a IDE where I could test the plugin within the octoprint environment) is that the modification of the gpio fails due to missing rights and the program exits.
My question is, what is the preferred way to execute a function call/code from an octoprint plugin which needs elevated permissions?
Do I need to put the wiringpi code into a separate script and call it via a suprocess?
How does octoprint execute the shutdown call to the system (which also needs "sudo")?