0

I can find in raspberry pi (5), using Raspbian, in directory /usr/include/linux the files i2c.h and i2c-dev.h. I am looking for the .c files that have the I2C functions and use the header files.

raspberry i2c files

Looking at the linux's I2C drivers, I can see that both .h and .c files are located in the same directory, so its weird to me that in Raspberry they are separated.

In which directory the .c files with the I2C functions are?

4
  • You only need the c files if you want to rebuild the kernel. For using the library, just use the h file and link to the corresponding library (not sure how that's named in this case, though).
    – PMF
    Commented Jan 31 at 13:32
  • All right, then the source files are not in the pi. In that case the question would change, I now want to know which of the files in linux/drivers/i2c/busses/ in linux's kernel are the ones for the I2C of the pi? Since I do not see "ARM" in the list. Commented Jan 31 at 13:36
  • @ChristianidisVasilis add your question to yout post ... a comment is not the place for it
    – jsotola
    Commented Jan 31 at 17:19
  • 1
    The I²C code is compiled into the kernel (or probably a loadable kernel module). There are user space libraries to interact with these (hence the .h headers). You could also write your own using ioctl calls. Generally these are not Pi specific but common Linux and the Pi specific code in drivers.
    – Milliways
    Commented Jan 31 at 21:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.