(I have no clue about udev rules, I copied that from the rpi-gpio-common package)
Code: Select all
SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="dialout", MODE="0660" SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:dialout /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'" SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:dialout /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"
Running programs that use the bcm2835 library ( http://www.airspayce.com/mikem/bcm2835/ ) as root works perfectly fine. Trying to run them as non root gives permission denied.
While I could give elevated permissions to /dev/mem this seems like a way to invite pain and suffering.
I could of course always run my program as root, but that of course is a major security risk, too.
So my prefered way of handling this is to install the gpio device drivers that add the gpiomem device to /dev/
After looking for quite some time, I have found nothing much of interest
particularly I have found this: https://www.theseus.fi/bitstream/handle ... yen_Vu.pdf
which doesn't really help
and this: https://github.com/torvalds/linux/tree/ ... ivers/gpio
which I don't know what to do with.
Oddly enough I have a /dev/gpiochip0 device. I don't know what that is.
I found this: https://fosdem.org/2018/schedule/event/ ... _for_linux. (PDF extention missing)
I don't know if it's a substitute or equal or what. I don't wanna write an entirely new driver to port this over.
also this: https://elixir.bootlin.com/linux/latest ... /sysfs.txt
Any help would be welcome.
On a side note:
Another thing. I tried installing the python3-rpi.gpio package. Trying to import RPi.GPIO results in:
"Can only be imported on a raspberry pi".
I am on a pi, but it doesn't seem to care.
I don't use the python stuff though, so that's not a priority. I just installed the package because I thought it might install the gpiomem device for me.
for anyone interested, I use bcm2835 library with a mono driven dot net project with raspberrypidotnet
https://github.com/cypherkey/RaspberryP ... ryPiDotNet