2

I am working on Linux 3.14.28, build with buildroot for an embeded system.

How can I read the file /sys/devices/i2c.4/i2c-1/1-0052/eeprom without root privilege?

Is there a solution to permanently change permission instead of changing it on each reboot of Linux with a script.

I'm not using udev but static table. I easily manage to change permission:

  • using device_table_dev.txt for /dev files
  • using device_table.txt for /home/files

But it has no effect on /sys/devices/i2c.4/i2c-1/1-0052/eeprom

AntoineC
  • 111
  • 1
  • 2
  • 10
  • its a possible duplicate of [link](http://unix.stackexchange.com/questions/68897/how-to-set-permissions-in-sys-permanent) – rahul tyagi Jun 16 '15 at 15:16
  • I checked all node of the tree, and it doesn't seems to be a link. I was first working on `/sys/bus/i2c/devices/1-0052/eeprom` which is a link, but I change for the "real" file and tree – AntoineC Jun 16 '15 at 15:54
  • You have to change the permissions to the host controller device, something like `/dev/i2c-1`. – 0andriy Jun 17 '15 at 08:29

2 Answers2

1

First and foremost, don't use static table. It really doesn't make any sense to not use devtmpfs these days, unless you're using a kernel older than 2.6.32.

Then, the device table is about changing permission of files in /dev. The permission of files in /sys is directly controlled by the kernel itself.

Thomas Petazzoni
  • 5,636
  • 17
  • 25
0

You need to adapt the permissions of the i2c bus device file /dev/i2c-*, not the eeprom file in /sys.
Using udev following rule should do the job:

KERNEL=="i2c-[0-9]*", GROUP="dialout"

Generally something similar should be also possible with static table as you can handle /dev/i2c-* like every other /dev/* file.

g0hl1n
  • 1,367
  • 14
  • 28