2

I have a custom hardware, i.mx6q based board, running a custom stripped version of Debian, the usual Linux tools to make life easy are not available.

Can I read and write to i2c directly with root access to /sys/bus/i2c/devices/[device] using standard tools such as echo, etc?

  • What tools are not available? Is it not possible to compile/build them and install them? – Faheem Mitha Jun 5 '14 at 13:43
  • It's time consuming, since the libraries and dependencies for them are not available either in many cases. – Stonie Jun 5 '14 at 14:22
1

According to this Linux Journal article, titled: I2C Drivers, Part II:

All I2C chip drivers export the different sensor values through sysfs files within the I2C chip device directory. These filenames are standardized, along with the units in which the values are expressed, and are documented within the kernel tree in the file Documentation/i2c/sysfs-interface (Table 1).

Table 1. Sensor Values Exported through sysfs Files

  • temp_max[1-3] Temperature max value. Fixed point value in form XXXXX and should be divided by 1,000 to get degrees Celsius. Read/Write value.
  • temp_min[1-3] Temperature min or hysteresis value. Fixed point value in form XXXXX and should be divided by 1,000 to get degrees Celsius. This is preferably a hysteresis value, reported as an absolute temperature, not a delta from the max value. Read/Write value.
  • temp_input[1-3] Temperature input value. Read-only value.

As the information in Table 1 shows, there is only one value per file. All files are readable and some can be written to by users with the proper privileges.

So it would appear that somethings under /sys/bus/i2c/devices/[device] can be written to using standard tools such as echo, but others may not.

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.