access error i2c device file

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

access error i2c device file

1,456件の閲覧回数
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)
2 返答(返信)

1,347件の閲覧回数
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,347件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport
0 件の賞賛
返信