0

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:/ #
ylmzekrm1223
  • 103
  • 5
  • 15

2 Answers2

1

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

You have to change it.

Community
  • 1
  • 1
CL.
  • 173,858
  • 17
  • 217
  • 259
1

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*

Paulo Fidalgo
  • 21,709
  • 7
  • 99
  • 115
  • Yes I have an apk and I need to read and write this i2c device. I give permission via adb shell everytime for read and write. I dont use Android permissions manifest yet. As you, optimal solution using permission manifest? – ylmzekrm1223 Nov 11 '14 at 09:19
  • @ylmzekrm1223 I've edit the question with more acurate information. – Paulo Fidalgo Nov 11 '14 at 09:53
  • Yes I am root but after restart the tablet, permissions change old status. I have to change permissions every restart now via adb shell. – ylmzekrm1223 Nov 11 '14 at 10:18
  • @ylmzekrm1223 so your only choice seems to be change the init.rc file by adding the same command you do in adb to change the permissions. – Paulo Fidalgo Nov 11 '14 at 10:20