Bug in usermode i2c-dev.h
Hi,
There is a discrepancy between the i2c_msg structure from the kernel i2c.h:
struct i2c_msg {
__u16 addr; /* slave address */
__u16 flags;
__u16 len; /* msg length */
__u8 *buf; /* pointer to msg data */
};
and the lm_sensors-2.9.2 usermode i2c-dev.h version of i2c_msg:
struct i2c_msg {
__u16 addr; /* slave address */
unsigned short flags;
short len; /* msg length */
char *buf; /* pointer to msg data */
int err;
short done;
};
The err and done members don't actually exist in the kernel version (I checked 2.6.11 and 2.6.15).
This causes the 2nd and subsequent messages to not lineup when you use the I2C_RDWR ioctl.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
Hi Dave,
Quoted 20 lines
There is a discrepancy between the
i2c_msgstructure from the kerneli2c.h:struct
i2c_msg{
__u16addr; /* slave address */
__u16flags;
__u16len; /* msg length */
__u8*buf; /* pointer to msg data */
};and the lm_sensors-2.9.2 usermode
i2c-dev.hversion ofi2c_msg:struct
i2c_msg{
__u16addr; /* slave address */
unsigned short flags;
short len; /* msg length */
char *buf; /* pointer to msg data */
int err;
short done;
};
Quoted 5 lines
The err and done members don't actually exist in the kernel version (I checked 2.6.11 and 2.6.15).
This causes the 2nd and subsequent messages to not lineup when you use the
I2C_RDWRioctl.
This was already reported by Hideki Iwamoto in September 2005, and was fixed in lm_sensors CVS back then.
http://lists.lm-sensors.org/pipermail/lm-sensors/2005-September/013726.html
Now, I wonder if we shouldn't also set flags, len and buf to __u16, __u16 and __u8*, respectively, for more consistency. Thoughts anyone?
Thanks for reporting anyway.
Signature · 1 line
Jean Delvare