access error i2c device file

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

access error i2c device file

1,392 次查看
janmennen
Contributor II

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

标记 (2)
2 回复数

1,283 次查看
janmennen
Contributor II

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

1,283 次查看
jimmychan
NXP TechSupport
NXP TechSupport
0 项奖励
回复