As per my earlier post, I am in the process of making a focuser driver for Raspberry Pi with the A4988 stepper driver.
I find the best performing option for RPi GPIO access is via /dev/mem, which requires root access.
I have had some trouble getting setuid access to work, and have found the issue is with following snippet in indidrivermain.c dropping the effective uid:
Sorry for diggin out this old thread but I stumbled upon it while investigating how to access gpio's without root
on non raspbian systems like gentoo on my RaspberryPi 2.
I was trying to start an indiserver as normal user with indi_wiringpi_gpio driver which gave an error:
wiringPiSetup: Unable to open /dev/mem
Check the group and its "rw" status of
pi@astro ~ $ ls -lah /dev/gpiomem
crw-rw---- 1 root gpio 245, 01. Jan 1970 /dev/gpiomem
If gpio doesnt exist just create that group and change the group ownership of "/dev/gpiomem"
to it. Then add your ordinary user to the gpio group and you should have non root
access to gpio. Of cause you then have to do the change of gpiomem on every reboot so just put it in
a system startup script
--= human, without Windows™ =--
pls excuse my bad english!
Ok, this seems not to work with code that uses the bcm2835 library (like the astroberry focuser driver) that accesses /dev/mem.
Even changing group and permission of /dev/mem seems not to work for non-root access.
If anyone is aware of another trick please share it. In the meantime I'll willy-nilly have to use root
to start my indiserver
--= human, without Windows™ =--
pls excuse my bad english!