I get EACCESS error when opening i2c-2 device file when using Android-NDK build and called via JNI
When using i2c tools i don't have this problem.
int i2cbus = 2; sprintf(fileName, "/dev/i2c-%d", i2cbus); if ((file = open(fileName,O_RDWR)) < 0) { LOGE("Error opening %s file=%d error=%d", fileName, file, errno); if (errno == EACCES) LOGE("Run as root?\n"); return -1; }
Seems i have to change the access rights of the device file. How to do this permanently. When i do chmod 666 setting is changed but after reboot it is getting its old value.
Does someone knows how to solve this issue
Thanks Jan
Problem is related to security mode avc: denied kernel error
When i enable permissive mode the problem is solved see:
https://source.android.com/security/selinux
androidboot.selinux=permissive
This may help you android - AOSP device node access permissions - Stack Overflow