简体   繁体   中英

file permissions change old status for every restart

I connect to the linux kernel of tablet via adb shell, and I give all permissions to all user for /dev/i2c* file clearly. Then I write and read succesfully theese files. But, when I restart the tablet, all permissions change old status. How I change permissions constantly, Anyone have a suggestion?

127|root@android:/ # ls -l /dev/i2c*
ls -l /dev/i2c*
crw-rw-rw- root     root      89,   0 2000-01-01 02:00 i2c-0
crw-rw-rw- root     root      89,   1 2000-01-01 02:00 i2c-1
crw-rw-rw- root     root      89,   2 2000-01-01 02:00 i2c-2
root@android:/ #

On Android, such permissions are set in init.rc .

You have to change it .

The devices are created on boot by the kernel system, so you need to set the permission after the boot, every time, otherwise they will be lost. You can change this in the init, altough I think you need to get your device rooted, otherwise it will be impossible.

If you are doing this in an application you're doing it wrong, because you should use Android permissions manifest.

This setence is wrong: for what I've seen there's no permissions to get access to i2c devices, you reelly need to change them on init.rc file.

Also from your log being root is not a problem, because you're already root:

127|root@android:/ # ls -l /dev/i2c*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM