i2c-2.8.0 : userspace applications using /dev interface
Dear Ladies and Gentlemen,
We lack some understanding on how i2c-2.8.0 userspace applications using the /dev interface and ioctl()s have to be programmed (we tested with kernel 2.4.22).
It seem to be necessary to include i2c.h in addition to i2c-dev.h in order to get access to defines like I2C_SLAVE for the ioctl()s.
However, i2c.h can not be included by userspace applications because it uses kernel space typedefs and declarations.
This is in agreement with your example in the LM Sensors project (prog/detect/i2cdetect.c). It uses I2C_SLAVE without including i2c.h.
Is there a way out here ?
Best regards
Peter Lassahn
plain text now
Quoted 9 lines
-----Urspr?ngliche Nachricht-----
Von: Peter Lassahn [mailto:[email protected]]
Gesendet: Donnerstag, 11. September 2003 10:47
An: '[email protected]'
Betreff: i2c-2.8.0 : userspace applications using /dev interfaceDear Ladies and Gentlemen,
We lack some understanding on how i2c-2.8.0 userspace applications using
the /dev interface and ioctl()s have to be programmed (we tested with kernel 2.4.22).
Quoted 2 lines
It seem to be necessary to include
i2c.hin addition toi2c-dev.hin order
to get access to defines like I2C_SLAVE for the ioctl()s.
Quoted 2 lines
However,
i2c.hcan not be included by userspace applications because it
uses kernel space typedefs and declarations.
Quoted 1 line
This is in agreement with your example in the LM Sensors project
(prog/detect/i2cdetect.c). It uses I2C_SLAVE without including i2c.h.
Quoted 6 lines
Is there a way out here ?
Best regards
Peter Lassahn
Quoted 8 lines
We lack some understanding on how i2c-2.8.0 userspace applications using the/dev interface and ioctl()s have to be programmed (we tested with kernel 2.4.22).
It seem to be necessary to include
i2c.hin addition toi2c-dev.hin order to get access to defines likeI2C_SLAVEfor the ioctl()s.
Quoted 6 lines
However,
i2c.hcan not be included by userspace applications because it uses kernel space typedefs and declarations.
This is in agreement with your example in the LM Sensors project (prog/detect/i2cdetect.c). It usesI2C_SLAVEwithout includingi2c.h.Is there a way out here ?
I had a hard time understanding how it can work, and it turns out that the trick is that there are *two* different versions of i2c-dev.h. The version that comes with i2c is small and intended for internal use only. The version that comes with lm_sensors is huge, and contains a large part of i2c.h, so that usespace applications can include it and work as intended. Use that second version, and everything should be OK. That is how i2cdetect, among others, is doing.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/