EEPROM - torizon user read access

Hello Toradex team,

I hope you are all doing great!



  • Linux verdin-imx8mp-14777482 5.15.77-6.3.0+git.ddc6ca4d76ea #1-TorizonCore SMP PREEMPT Thu Jun 29 10:14:22 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

Images tested:

  • torizon-core-docker-verdin-imx8mp-Tezi_6.3.0+build.4.tar (STABLE Release)

Guest OS:

  • macOS (M1 Pro ARM64)
  • Linux ubuntu (VM x86_64)

I’m having trouble to setup a udev rules to read the EEPROM only with user permission. The EEPROM is the same as the one on the Verdin board: i2c3@0x57.

I can access it with sudo access as follow:

$ sudo cat /sys/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-0057/eeprom

But I have to give the sudo permission, and I don’t want to for security reason.

I plan to store the serial number of my device on the EEPROM, and I want to be able to use it from my docker container. I have found this link but nobody seems to have a solution… Does anyone ever use this EEPROM and have an idea how I can access it ?

Best regards,

1 Like

Hi @unablesalt !

All good here! I hope you are doing great as well! :smiley:

Thanks for all the detailed information :heart:

Regarding accessing the EEPROM from userspace without using sudo, I searched online for linux eeprom user permission and found this StackOverflow thread: c - Reading and writing EEPROM via I2C with Linux - Stack Overflow

In there, a user redirects to another thread where there is an example of how to set the permissions via udev rule for a device accessible from /sys: linux - How can I change the permissions in /sys to alter the state of a LED/light using `udev`? - Unix & Linux Stack Exchange

I didn’t try it myself but seems to be a good idea.

To perform this change you can use TorizonCore Builder to add your custom udev rule.

Best regards,

1 Like

Hello @henrique.tx,

Thank you for your response! I hope you are doing great!

The documentation you gave me helped me, and I manage to write a custom rules and I can access it from the user torizon by adding the group i2cdev. Here it is:

DRIVER=="at24", ACTION=="add", RUN+="/bin/chgrp -R i2cdev /sys%p", RUN+="/bin/chmod -R u=rwx,g=rx,o= /sys%p"
DRIVER=="at24", ACTION=="change", RUN+="/bin/chgrp -R i2cdev /sys%p", RUN+="/bin/chmod -R u=rwx,g=rx,o= /sys%p"

Thank you again for your help, I’ll mark this post as solved.