Context:
I need to be able to manage GPIO to:
- Read values of gpios
- Write values of gpios
- Set direction (read/write) of gpio
- Set edges interruption and get events
- Optional: Set pull up o pull down
Desire solution
Problem
Can't get access to /dev/mem through JNI on my android app.
Especifically, I'm try to: "open("/dev/mem", O_RDWR | O_SYNC)"
but it doesn't work. In one of my tests, I tried to change the access permissions of the file to 777 but nothing changed, always got -1.
Do you have any idea of how I can access it?
I read in this forum, "To open /dev/mem you need both regular access permissions on the device file and the security capability CAP_SYS_RAWIO, or to be root"
In other forum says,
"
1) Run the program via "sudo" (this will be the most common advice given on this forum)
2) Make the program setuid root - or setgid kmem
3) Make pi be in the kmem group (and reboot to make it take effect)
"
But I can't run the program as root and setuid is not a valid command on the shell of emteria OS.
Do you know if I can "setuid root" to an App on Emteria?
Does Emteria OS have any libs to be able to manage GPIO?