0
votes

This is a similar post as device-node-access-permissions-in-linux 6 years ago without an answer.

I have a device node at /dev/magic-i2c created using misc_register(), the problem is the default access permissions for this device node is for root, and cant be accessed by AOSP libraries. I tried adding .mode = S_IRWXUGO but no effect. How can I change the permission of this device node automatically during bootup?

2
you could look at init.rc file, which tipically includes startup sequence. You just need to find appropriate place and place chmod/chown commands there - Alex Hoppus
For setting permissions in Android I believe you should look deeper at SELinux and configure proper policy for access to your device. - nowaqq

2 Answers

1
votes

You can add your device to this file in AOSP :

{AOSP DIR}/system/core/rootdir/ueventd.rc

First Add your device then set UID/GID and access mode for it.

0
votes

You can add chmod 660 /dev/magic-i2c in "on boot" section or somewhere in init.rc file. You can add this in any section in init.rc depending on when you need the permission to be given.